Need Help SOS

JohnInTX

Joined Jun 26, 2012
4,787
In LCD_INIT, you have to send 0011xxxx to the display 3 times with delays in between before sending Function Set. Review Fig. 24 in the 44780 datasheet. Note that you can't use LCD_OUT for this as that routine (correctly) writes the data byte in 2 nibbles. $ and L have the same LSnibble (x6). Its likely that the display is still in the 8 bit mode due to this problem. I would fix that, and if you still have problems, make sure that in LCD_OUT, PORTD gets first the MSnibble then the LSnibble of any passed byte. You might consider putting a GOTO $+1 between raising and lowering the LCD Enable line to ease r-m-w issues.

As far as ORGs are concerned, JohnP is correct. With no interrupts you only need ORG 0000h. The assembler will build from there. You'll never get to 0004h to GOTO START and you don't need ORG 0030h at all. CBLOCK 0020h is not a factor here - it assigns labels for RAM not program ROM.

Good luck.
 
Last edited:

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
A pattern ? there seems to be, because when I switch the swapf instruction to the second nibble, ie transmit the first data nibble first and then the second data nibble, it actually displays 3-4 characters correctly (in position and case), so I need Ideas on how to design an experiment to discover the pattern if there is any. one is to make it display only one character and map it according to the LCD controller's char map (attached picture).
What say?
I'll work on the things JohnInTX said first and if things don't straighten out from there bruteforce is the way to I guess
 

Attachments

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
hi guys,
nothing is working, so apart from the code, now i have also attached the Proteus schematic, seems correct to me, still check it out.
so now I'm going to find a pattern in the characters if there is one.
thanks
 

Attachments

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
Guys I got it, the problem was the additional STROBEs in the LCD_INIT subroutine I was strobing the LCD during each command where in fact it was being strobed in the LCD_OUT already. So I guess that was 'disabling' the LCD ? I cannot say for sure. anyway removing the extra strobing solved the problem.
thank you!
 

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
Hi again,
Now I'm bread boarding this project, and in the beginning all was good, the display was working quite well and the uC too, except the F-V section, now I've got the f-v working and the uC-lcd section has gone fubar.
 

Attachments

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
Now to enumerate the problems:
1. The initial message "MUSICAL TUNER" won't display on the LCD or the display is never initialized by the uc
2. When the contrast pot is turned all the way to ground, I get Two lines of black boxes instead of just one.

any Ideas?
 

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
ok guys, I got it sorted out,
1. I mistook the 9v rail for the 5v and drew it to the 16x2 lcd display.
2. It seems when I enable the Low Voltage Programming bit in the Config word, the PIC does nothing, nada. but when I turn off LVP, it runs like cake.
any explanations for point 2?
And yes now that I'm done with the breadboarding successfully, can I add this one to the finished projects around here?
Thanks yall.
 

tshuck

Joined Oct 18, 2012
3,534
ok guys, I got it sorted out,
1. I mistook the 9v rail for the 5v and drew it to the 16x2 lcd display.
2. It seems when I enable the Low Voltage Programming bit in the Config word, the PIC does nothing, nada. but when I turn off LVP, it runs like cake.
any explanations for point 2?
And yes now that I'm done with the breadboarding successfully, can I add this one to the finished projects around here?
Thanks yall.
See page 160 in the datasheet - 14.19Low-Voltage (Single-Supply) ICSP Programming.

While using LVP, if PGM is left floating, the pull ups will cause it to enter programming mode.
 

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
Hi, guys
my project has now turned into a frequency meter,
now I face a tacky problem. I am using the PIC's CCP1 module to capture the time period
of my input signal (square wave), but I can't figure out a way to convert whatever I get in the
ccp result registers into frequency in hertz.

any and all Ideas are most welcome.
thanks
 

Papabravo

Joined Feb 24, 2006
21,228
The period of a periodic waveform is the reciprocal of the frequency. For example, if the period is 16.67 milliseconds, then 1 / 16.67e-3 ≈ 60 Hz.
 

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
Ok, Ive converted the double word into unpacked 5-digit bcd (each digit represented by 8bit registers) but I still can't wrap my head around it.
 

Thread Starter

Zahir_s

Joined Dec 23, 2014
32
ok I got it working but it displays the correct value only once, the first time round. I used a divide routine from piclist and divided the system frequency by the ccp count. i'll post the code i some time (i need to comment it)
 
Top