serial communication problems


Closed Thread
Results 1 to 9 of 9
  1. #1
    bronorisp's Avatar
    bronorisp Guest

    Question serial communication problems

    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

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    bronorisp's Avatar
    bronorisp Guest


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    bronorisp's Avatar
    bronorisp Guest


    Did you find this post helpful? Yes | No

    Default

    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

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    bronorisp's Avatar
    bronorisp Guest


    Did you find this post helpful? Yes | No

    Default

    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.

  8. #8
    Join Date
    Jul 2003
    Location
    Sweden
    Posts
    237


    Did you find this post helpful? Yes | No

    Question

    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

  9. #9
    bronorisp's Avatar
    bronorisp Guest


    Did you find this post helpful? Yes | No

    Unhappy

    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

Similar Threads

  1. Serial communication problems
    By amindzo in forum Serial
    Replies: 0
    Last Post: - 28th August 2006, 17:48
  2. Serial communication problems
    By amindzo in forum General
    Replies: 0
    Last Post: - 28th August 2006, 17:47
  3. Serial Communication Problems (Strange!!)
    By Armando Herjim in forum Serial
    Replies: 1
    Last Post: - 20th June 2006, 22:46
  4. Bootloader,MCSP and Serial communication
    By surfer0815 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd March 2006, 10:52
  5. Replies: 8
    Last Post: - 11th November 2004, 20:08

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts