SLCD Baud Rate Problem


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    26

    Default SLCD Baud Rate Problem

    Greetings All,

    I have been trying to get the 16 x 2 Serial LCD Display from Renolds to work with my PIC16F628A so that I can display sensible output which would help with my other experiments.

    I finally got it to work on a Basic Stamp BS2p (major success). Code at bottom of message - as you can see it is pretty basic at this stage but it took me a long time to get this working.

    The question is how do I replicate this on my PIC with a 4MHz Oscillator.

    I tried the second lot of code at bottom of message, and got funny characters appearing so I figure I am pretty close just an issue with the baud rate.

    I also found if I followed other examples (and in the documentation) and put in a N9600 I got a BAD EXPRESSION ERROR. What is that all about.

    Thanks in advance.

    Cheers Bruce

    === STAMP CODE ==================================================

    ' {$STAMP BS2p}
    ' Author: Bruce Sim
    ' Description: Just trying to show something on the SLCD Display
    ' Date: 16 Oct 2007

    PAUSE 2000

    start:

    SEROUT 0, 16624, [$1b, $2a, $80] ' Set LCD backlight TO about half brightness
    PAUSE 500
    SEROUT 0, 16624, [$1b, $30] 'Clear screen AND move cursor TO start of first line
    PAUSE 500
    SEROUT 0, 16624, [$1b, $42] ' Turn on blinking cursor
    PAUSE 500
    SEROUT 0, 16624, [$1b, $55] ' Turn on underline cursor
    PAUSE 500
    SEROUT 0, 16624, ["Hello Bruce", CR] 'Display Text
    PAUSE 1000
    SEROUT 0, 16624, [$1b, $30] 'Clear Screen
    PAUSE 500
    GOTO start

    === PIC Code ==================================================

    ' {PIC 16F628A - with 4MHz Oscillator}
    ' Author: Bruce Sim
    ' Description: Just trying to show something sensible on the SLCD Display
    ' Date: 16 Oct 2007

    PAUSE 2000

    DEFINE OSC 4

    start:

    SEROUT 0, 9600, [$1b, $2a, $80] ' Set LCD backlight TO about half brightness
    PAUSE 500
    SEROUT 0, 9600, [$1b, $30] 'Clear screen AND move cursor TO start of first line
    PAUSE 500
    SEROUT 0, 9600, [$1b, $42] ' Turn on blinking cursor
    PAUSE 500
    SEROUT 0, 9600, [$1b, $55] ' Turn on underline cursor
    PAUSE 500
    GOTO start

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Check your PBP manual for SEROUT baud modes. SEROUT 0,9600 is not valid for SEROUT.

    SEROUT 0, 16624 for the BS2p is 9600 baud, driven, inverted. To match this with PBP just
    look up the baud mode number for 9600 baud, driven, inverted. SEROUT 0, 6 would output
    serial data on RB0 at 9600 baud, driven, inverted.

    If you include "modedefs.bas", then you could use SEROUT 0,N9600 which is somewhat
    easier when porting code from Stamps to PBP.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Oct 2007
    Posts
    26


    Did you find this post helpful? Yes | No

    Smile Perfect

    Greetings Bruce

    Exactly what I needed thank you very much.

    Cheers Bruce

Similar Threads

  1. A Serial GLCD 128x64 Simple Project
    By Oldspring in forum Off Topic
    Replies: 0
    Last Post: - 8th March 2010, 20:58
  2. PIC 18f1220 EUSART Baud Rate Cache Problem
    By wklose99 in forum Off Topic
    Replies: 3
    Last Post: - 15th April 2008, 00:39
  3. Auto Baud Rate Detection
    By mytekcontrols in forum Serial
    Replies: 10
    Last Post: - 31st October 2005, 02:17
  4. PIC12F675, accuracy of baud rate with Internal Oscillator
    By Chris Mayhew in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st August 2005, 22:41
  5. Baud Rate and Timing Calculator
    By picnaut in forum General
    Replies: 3
    Last Post: - 23rd January 2004, 16:48

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