Baud Rate declared as a Constant


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2007
    Posts
    24

    Default Baud Rate declared as a Constant

    Hi,
    I have just stumbled onto a problem. If I declare the baud mode on SEROUT2 as a constant it compiles Okay but doesn't work.
    eg:
    BAUD CON 84
    SEROUT2 PORTB.2, BAUD,["TEST",13]

    But this does work
    BAUD var Byte
    BAUD = 84
    SEROUT2 PORTB.2, BAUD,["TEST",13]

    I have tried it with both 16F88 and 18F4550 pics and I have seen this method used in other posts such as http://www.picbasic.co.uk/forum/showthread.php?t=3789.

    Is this usual or is it just me or my programmer or something.
    Thanks for any ideas. Mike

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Try
    Code:
    BAUD VAR WORD
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jun 2007
    Posts
    24

    Default Why not CON

    Thanks for your reply Dave.

    BAUD Var Word works as does Byte if its less than 255.

    My question is why doesn't CON work when I can't find any reference to it in the Manual and espesially as Bruce had it in some code at http://www.picbasic.co.uk/forum/showthread.php?t=3789

    Maybe it works in PM but not MPASM.

    Mike

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Sorry, I read it backwards.

    BAUD CON 84
    should work fine. And I never use PM...

    So I do not know why it does not work for you.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jun 2007
    Posts
    24

    Default Thanks

    Okay, thanks Dave.
    I'll just have to put it down to another one of those weird things that happens.
    Cheers,
    Mike

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 : 1

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