lcd with Hserout and a max232 connections? help


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Posts
    65

    Default lcd with Hserout and a max232 connections? help

    Hello

    I wanted to drive my serial LCD with Hserout (for a test), on a pic16f628a, but I can't seem to shoot understandable data on the tx line.

    First I realised it wanted an inverter, so I plugged a Max232, and used only the inverter feature(removed capacitor on the -10 +10 v port... multimeter agreed it does the job).

    But i'm still getting trash data on the display...

    here is the code
    :
    ' Initialize USART
    input portb.1
    output portb.2
    RCSTA = %10010000 ' Enable serial port and continuous receive
    TXSTA = %00100000 ' Enable transmit and asynchronous mode
    define HSER_BAUD 9600
    define HSER_CLROERR 1

    hserout [12,"* LED FADER *"]


    see jpeg for circuit layout (may be wrong...)

    Attached Images Attached Images  

  2. #2


    Did you find this post helpful? Yes | No

    Default Condition the data line first

    I found that I needed to set the RS-232 drive pin high some milliseconds before sending data. Otherwise I just got a string of gibberish on the terminal.

    This is to put the RS232 output low which is the defined MARK or IDLE condition for the RS-232 interface.

    Try something like...

    High portb.2
    pause 5
    hserout [12,"* LED FADER *"]

    HTH
    BrianT

  3. #3
    Join Date
    Jul 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Tnx Brian

    for some reasons I still get garbage when sending text string(even with your trick), but single characters as in the following code appear ok...(I see a bunch of lowercase alphabet char)

    For cycle = 25 to 70
    hserout [12,cycle]
    serout PortLCD, N9600, [12,"Hserout loop ",#cycle]
    Pause 200
    next

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    For cycle = 25 to 70
    hserout [12,cycle]
    serout PortLCD, T9600, [12,"Hserout loop ",#cycle]
    Pause 200
    next

    ???

  5. #5
    Join Date
    Jul 2007
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    I was just testing sending char thru serial Hardware...

    Actually it's 33 to 58 that gives a to z in lower case, to be exact, and it's supposed to be 97 to 122 according to documentation.


    regular Serout is doing the job perfect.

  6. #6


    Did you find this post helpful? Yes | No

    Default

    FYI, if you are really using the meLabs Serial LCD, you don't need the Max part. According to the data for the Serial LCD there is a jumper that will change the input polarity(JP3). Here is what the manual says about HSER signals :

    "Since the serial transmission is done in hardware, it is not possible to set
    the levels to an inverted state to eliminate an RS-232 driver. Therefore a
    suitable driver should be used with HSEROUT."

    Also, I would be very careful about trying to do both HSER and SER commands to the same pin. The hardware serial expects a specific pin to be used, and if the pin is connected to the UART, it may not be usable as a standard I/O. Try taking out the SEROUT code and just run it with HSEROUT.

    Another bit from the PBP manual:

    "All baud rates at all oscillator speeds may not be supported by the device. See the Microchip data sheet for the hardware serial port baud rate tables and additional information."

    This means you need to double check the data sheet if you are using any crystal freq other than 4 MHz.
    Last edited by falingtrea; - 6th March 2008 at 19:37.

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