PDA

View Full Version : serial communication problems



bronorisp
- 3rd January 2005, 06:57
Hello,

Happy New Year to all! I'm new to the PIC programming world so please bear with me, if my questions seem a little trivial. I'm programming the PIC 16F84A, using PBP software online by membership from compilespot.com. Using a 16 x 2 serial LCD module with 3-wire up. I understand from threads posted here, this should be a no brainer; however, when I try to print "Hello World" I receive different characters and symbols on the display.
Can someone explain what I may be doing wrong? Thanks for any light you can shed on this matter.

New Kid on Block

mister_e
- 3rd January 2005, 16:00
Will be a bit more simple for us if you send your code and harware description. BUT i figure you're using an serial LCD in that project. Can be a BAUDRATE problem. Be sure of this setting first (2400, 4800, 9600... )

Try to send a lcd clear function before sending data. Also, be sure your serial comm type is the right one i.e. inverted or not.

bronorisp
- 3rd January 2005, 23:49
Steve,

I checked the baud rate and the jumpers on the LCD Module are set for True 1200. If I perform a self-test on the unit, it comes on and display on the first line “Self Test Mode” and on the second line “Baud Rate: T1200”. Here’s the code for the program. Thanks for your help.

'PICBasic Pro Program 6.2 --LCD Test --
Pause 1000 'Wait 1 second for LCD to initialize
start:
Serout Portb.1, 1, [254,1] 'Clear screen
Pause 40
Serout Portb.1, 1, ["Hello World"] 'Print Message
Pause 400
GoTo start
End

Hardware:

EPIC Plus Pocket PIC Programmer w/ AC Adapter
PIC 16F84A-20/P
LCD-02 Serial LCD model w/ backlight
4 Mhz crystal

mister_e
- 4th January 2005, 01:10
try this one

TRISB=0
PORTB.1=0

Pause 1000 'Wait 1 second for LCD to initialize
start:
Serout Portb.1, 1, [254,1] 'Clear screen
Pause 40
Serout Portb.1, 1, ["Hello World"] 'Print Message
Pause 400
GoTo start
End

bronorisp
- 4th January 2005, 05:59
Steve,

I used the code you supplied. The LCD printed the following: a period, pound sign, blank space, infinity sign (.#_ ). Repeated twice. Then it printed: a period, number 3, blank space, infinity sign (.3_ ). Repeated twice. Then started the sequence again. It’s much better than originally, I can recognize these characters. Does it matter if I’m using two different machines for programming? I use my desktop to go online and compile the program. I save the HEX file to a 3 ˝” floppy, transfer to my laptop and program the PIC using the EPIC DOS program.


Thanks

mister_e
- 4th January 2005, 12:27
Does it matter if I’m using two different machines for programming? I use my desktop to go online and compile the program. I save the HEX file to a 3 ˝” floppy, transfer to my laptop and program the PIC using the EPIC DOS program.


absolutely not!

In your case it still seems to be a kind of baudrate problem... But only to be sure...
1. Is your MCLR pin (pin 4) is tie to VCC ?
2. Do you place capacitors (around 15pf) if using crystal?
3. is a simple LED blink program on this PORTB.1 pin is working ?
4. Is your supply line = 5Volt and clean ?
5. What about if you add this line : DEFINE CHAR_PACING 1000
6. what about if you try higher baudrate ?
7. Is LCD ground is attach to the PIC ground?

bronorisp
- 17th January 2005, 16:11
Originally posted by mister_e
absolutely not!

In your case it still seems to be a kind of baudrate problem... But only to be sure...
1. Is your MCLR pin (pin 4) is tie to VCC ?
2. Do you place capacitors (around 15pf) if using crystal?
3. is a simple LED blink program on this PORTB.1 pin is working ?
4. Is your supply line = 5Volt and clean ?
5. What about if you add this line : DEFINE CHAR_PACING 1000
6. what about if you try higher baudrate ?
7. Is LCD ground is attach to the PIC ground?



1. pin 4 is tied to VCC
2. I'm using (22 pf) capacitors to the crystal
3. a simple LED blink program works great on PORTB.1
4. The supply line is a clean 5Volts
5. the DEFINE CHAR_PACING 1000 was added, it slowed the print a little on the display, but the characters are still not correct.
6. I tried a higher baudrate, same results.
7. the LCD ground is attached to the PIC ground

I read an article that said, sometimes when using a WINDOWS OPERATING SYSTEM it can cause havoc in the timing when communicating using the BIT BANG method. I'm not sure if this is the case with me or not. Is there some additional hardware I can add to my circuit, to by pass this BIT BANG method? Thanks for all your help.

Ingvar
- 17th January 2005, 17:48
Have you tried sending the data inverted?

Pause 1000 'Wait 1 second for LCD to initialize
start:
Serout Portb.1, 5, [254,1] 'Clear screen
Pause 40
Serout Portb.1, 5, ["Hello World"] 'Print Message
Pause 400
GoTo start
End

bronorisp
- 20th January 2005, 23:50
Thanks Ingvar,

I've tried inverted and true at different baud rates, same results, will not print correctly. I think something must be wrong with both my machines. I'll keeping tinkering until something gives. Thanks to everyone in this forum for your help and guidance concerning this matter.

Thanks