pic 16f84a to axe033 lcd

vansloun

New Member
I have bought the serial lcd & clock ( axe033) and have no problems using this with the 8m chip. However when I try to generate output from an ordinary pic the control commands don't work properly,I am unable to position the character where I want it and the default after clearing the display with 254,1 is the start of the second line. I also can't output whole words, instead of "hello" I need to code each character separate "h" with a pause of 2 sec then "e" pause 2 seconds etc ( actually I have to put in the whole code : serout 3, N2400, ("h") etc)
Also when I want to display a variable generated from an 8 bit a/d chip I am unable to display numbers above 9, I get different characters displayed after this ( some part of the standard character pattern).
I used to be able to output everything fine with my previous lcd ( bought from Cornhill), unfortunately I ruined that one.
Any ideas ?

Thanks Hans
 

hippy

Ex-Staff (retired)
It sounds to me like there may be a problem with your PICmicro transmit code, perhaps a missing stop bit or maybe not enough gap between bytes.

The problem with not displaying numbers greater than 9 sounds like a coding error in the number formating routines.

Is this PICmicro code generated by the Programming Editor Basic to Assembler Converter or is it hand-crafted Assembler or generated using some other compiler ?
 

demonicpicaxeguy

Senior Member
few questions about the pic16f84a

1 why the pic16f84a , requires a resonator/crystal
2 what generated the code?or is it handwritten in asm,
3 what frequency are you running the pic at?
4 which pin are you using for serial out?
5 what fuses are set?
6 whats the power supply?(eg car battery ,aa's ,pc powersupply,wishful thinking)
7 if possible could you post the code
 

vansloun

New Member
Hi,
Thanks very much for your responses.I am quite new to electronics so forgive me if I make some big mistakes here and there.
I started out doing projects from a book by John Iovine ( picmicrocontroller project book) I bought an lcd display ( milford 16x2 and a few pics and programming software etc)
Recently I did an experiment from his book ( AD converter using a TLC 549 8 bit chip) I did output the variable to the LCD and all was well.
However I managed to reverse the polarity to the LCD and fried the controller chip .
I had also started to use the picaxe to interface with an ibutton ( the lock kit) ( I copied this to start experimenting with eagle software) and am working my way through the book from David Lincoln.
I am currently using mplab ide v 7.60 just to program in basic then use picbasic compiler v 1.44 from microengineering labs to generate the hex file and use epicwin 2.42 to transfer code to the pic ( so that's why I use the pic 16f84a)
The pic is run at 4 mhz, power from a 5 volt voltage controller 7805, serial out pin is pin 9 on the pic.

I have simplified the code to just displaying the word hello as separate letters and as a whole word.
No problem with the picaxe 08m, works like a dream ( also have the timer chip and everything works )
however with the pic the program puts out the word hello on line 2 alternating with h? ?o
the ? ? are actually also characters with a space in the middle. It seems this lcd has the same coding as the one displayed on the website http://www.myke.com/lcd.htm it outputs the characters "Y" instead of the "e" and instead of the second "l" a japanese character 10111101.
I tried a different 16f84a -> exactly the same problem.

Here is the code

'LCD routine
Pause 500 'initiate LCD
start:
serout 3,N2400, (254,1) ' clear screen goto line 1 position 1
Pause 30
serout 3,N2400, ("h") 'send byte to lcd
Pause 30
Serout 3,N2400, ("e") 'send byte to lcd
Pause 30
Serout 3,N2400, ("l") 'send byte to lcd
Pause 30
Serout 3,N2400, ("l") 'send byte to lcd
Pause 30
Serout 3,N2400, ("o") 'send byte to lcd
Pause 500
serout 3,N2400, (254,1) ' clear screen goto line 1 position 1
Pause 30
Serout 3,N2400, ("hello")
Pause 1000 'let me see display
Goto start
End

Hans
 

hippy

Ex-Staff (retired)
If that's the code for the 16F84a it might be worth trying a "Low 3" and a "Pause 100" at the start so the output line is setup before the first data is transmitted. That doesn't explain the incorrect characters though, that sounds more like a baud rate problem.

One thing you could try, as N2400 is compatible for feeding directly to a PC, is to disconnect the serial output from the PICAXE/16F84a to LCD and send that up the serial cable to the PC and use a Terminal Emulator or the Programming Editor Terminal function to see what is being received.

If it works with the PICAXE but not the 16F84a then there's something amiss with the 16F84a or the compiled program, if it works okay with both then there's some issue with interaction between the 16F84a and the AXE033.
 

demonicpicaxeguy

Senior Member
the whole coding process then compiling then pogramming sounds a little complex and prone to errors, i've send you a pm with a link to a good compiler and simulator which i've used for some time now and haven't managed to get 1 error in the code yet
 

vansloun

New Member
Thanks for all the suggestions.

I edited the program but alas no change.
I checked the code in terminal and the output is fine, both the picaxe and the pic transmit the same ( I amended the programs to only the word hello -> exactly the same output , I used separate characters between exclamation marks and whole words but that does not make any difference.)
Thanks for the tip about the alternative software.
I am also studying another book "pic in practice " which uses mplab which can output the asm files ( because it is a book about assembler) to hex files. According to the makers of the software I use it should be compatible. I agree very complicated procedure and I even don't have a ZIF socket !
There is a curious remark in the literature that comes with the LCD and clock, on page 8 it states " Note the use of N2400 ( not t2400 within Picaxe programs. Note the serial LCD does not buffer bytes received, and so a small delay between bytes ( to update the display) is required on non-PICAXE systems . THIS DELAY IS AUTOMATICALLY APPLIED BY THE PICAXE SYSTEM."
Could this account for the problem ? Are there more bits flying around then I see on the terminal program? Because when letters are separated they display properly with the pic but not when written as a word. It does default to the second line which I don't understand and I can't change this with another code ( like 254,128).
I wonder if anyone has the code to run an lcd display from a p16f84a or a 16f818 ( serial if possible) so I can try it out. I do have a code in asm but unfortunately that uses a 32 khz crystal anud used 4 datalines and 2 control lines. ( BTW that works fine between pic and my previous display ( I removed the controller board which used a pic 16C54)

Thanks again for everyones input ,much appreciated.
Happy Christmas
Hans
 

demonicpicaxeguy

Senior Member
if the lcd doesn't have a serial buffer then you most likely have to put a delay between bytes wether you are using a picaxe or raw pic the output will show up perfectly on hyperterminal because it's buffered

start out with a 500ms delay betwen characters and reduce that until things are nice and quick but also reliable and transmitt each letter individually

i have some code here i can modify for a 16f628a,16f84a,16f88,16f818 that work with most of the HD44780 compatible lcd's
 

vansloun

New Member
Hi demonicpicaxeguy( any abreviation for that?)
Thanks for your continued interest.
I did initially what you suggested and I had to put in every letter seperate ( see first post) .The minimum pause was 2ms. I could not get the control code right everything ended up on the second line by default. Also I have the problem displaying a number in a variable .How do I put in a pause when the value is 3 digits ? Can you help me with some simple code to do that.
I'd be very interested to see your code and try it on a pic .

Is there any way of analysing the serial output more closely ? Or is there anywhere a tool which can grab the serial input and output it in a graph or ? digital oscilloscope ( I have no experience with that at all ,so it has to be fairly simple).
Thanks
( BTW I do have a 74LS164 which I can use as well )
Hans
 
Last edited:

demonicpicaxeguy

Senior Member
Hi demonicpicaxeguy( any abreviation for that?)
Thanks for your continued interest.
I did initially what you suggested and I had to put in every letter seperate ( see first post) .The minimum pause was 2ms. I could not get the control code right everything ended up on the second line by default. Also I have the problem displaying a number in a variable .How do I put in a pause when the value is 3 digits ? Can you help me with some simple code to do that.
I'd be very interested to see your code and try it on a pic .

Is there any way of analysing the serial output more closely ? Or is there anywhere a tool which can grab the serial input and output it in a graph or ? digital oscilloscope ( I have no experience with that at all ,so it has to be fairly simple).
Thanks
( BTW I do have a 74LS164 which I can use as well )
Hans
that raises an interesting point about displaying a variable's value as a number on a serial lcd screen
this is where the parallel interface (without the serial module) is a better option, it's also quicker,

for the lcd code i have, i need to dig it out of the latest backup (i've just reinstalled xp on the laptop) and also sort out which pins go where for the lcd and re compile it for use on a pic16f84a
which brings me to the other question what speed is it going to run at?

as for the serial analyser i just use another serial port on another pc

and the nickname has been abreviated to DPG quite frequently

i'll try and post the code for a 16f84a tonight i've just got to wireup the lcd and test the code
 
Last edited:
Top