need help to set up a serial link


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

    Default need help to set up a serial link

    hi, i m doing my fyp title serial link communication, now i m using pic16f84 as my controller, i connect my pic to RS232(MAX232CPE-the chip i use), then connect it to computer. now i m using the command as following

    __________________________________________________ ______________

    Include "modedefs.bas" 'to enable the mode option for n9600

    trisa = %00010
    TRISB = %00000000

    symbol sec = 1000

    d0 var byte
    s_out var porta.0 'set pin no as output pin
    s_in var porta.1 'set pin no as input pin
    led var portb.4

    loop:
    Serin s_in, n9600, 1000, no_data, ("x"), [d0]
    serout s_out, n9600, [d0]

    goto loop

    no_data:
    high led
    pause sec
    goto loop

    end

    __________________________________________________ ______________

    how come i dun c the led light and i dun get any data from the pic...
    p/s: how can i know whether my code is successfully sent? any idea to do tat?

  2. #2
    Join Date
    Aug 2005
    Posts
    95

    Default You need to set serin and serout to TRUE

    Try this.
    --------------------------------------------------------------------------
    Include "modedefs.bas" 'to enable the mode option for n9600

    trisa = %00010
    TRISB = %00000000

    symbol sec = 1000

    d0 var byte
    s_out var porta.0 'set pin no as output pin
    s_in var porta.1 'set pin no as input pin
    led var portb.4

    loop:
    Serin s_in, T9600, 1000, no_data, ("x"), [d0]
    serout s_out, T9600, [d0]

    goto loop

    no_data:
    high led
    pause sec
    goto loop

    end
    --------------------------------------------------------------------------
    Sphere

  3. #3
    kinsiro's Avatar
    kinsiro Guest

    Default

    cannot oh.. the compile process is fail.. it stated error line-bad expression.. error line-expected '('
    why will it like this?

  4. #4
    Join Date
    Aug 2005
    Posts
    95

    Default

    Tried compiling the program and got the same errors. What do you want the program to do and what commands are you sending to the pic.

    Sphere.

  5. #5
    Join Date
    Jul 2003
    Posts
    2,358

    Default

    Ahem... people!!!!

    The compiler is telling you what the problem is... let's all go back and read the MANUAL as to the correct SYNTAX for SERIN...

    Not this...

    Serin s_in, T9600, 1000, no_data, ("x"), [d0]

    ...but this...

    Serin s_in, T9600, 1000, no_data, ["x"], d0

    There's even an example in the book - read it!

  6. #6
    Join Date
    Aug 2005
    Posts
    95

    Default

    Hi Melanie still new to all this serial stuff myself, I just thought I would try to help some with the limited knowledge I have gained. By the way what part of the world are you from.

    Sphere.

  7. #7
    Join Date
    Jul 2003
    Posts
    2,358

    Default

    I'm pretty cosmopolitan actually, but for the last few years London England (hub of the Universe) is my home.

  8. #8
    Join Date
    Aug 2005
    Posts
    95

    Default

    Thanks for the reply Melanie.From the UK myself. Maybe we meet accross a keyboard again.

    Sphere.

  9. #9
    kinsiro's Avatar
    kinsiro Guest

    Default

    Quote Originally Posted by Melanie
    Ahem... people!!!!

    The compiler is telling you what the problem is... let's all go back and read the MANUAL as to the correct SYNTAX for SERIN...

    Not this...

    Serin s_in, T9600, 1000, no_data, ("x"), [d0]

    ...but this...

    Serin s_in, T9600, 1000, no_data, ["x"], d0

    There's even an example in the book - read it!
    thx malenie.. and every1 i had done the rs232 part.. n comm is perfect

Similar Threads

  1. Pin won't stay high during Repeat...Until loop??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th August 2009, 23:57
  2. Interruptus Frustratus
    By Byte_Butcher in forum General
    Replies: 16
    Last Post: - 17th April 2009, 20:36
  3. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  4. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

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