Rs232 and pic


Closed Thread
Results 1 to 7 of 7

Thread: Rs232 and pic

  1. #1
    irmus's Avatar
    irmus Guest

    Default Rs232 and pic

    Hello! I try this
    serout portb.2, n2400, [$A0] but its bad .Pic nothing send. Help!!!

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


    Did you find this post helpful? Yes | No

    Default

    hi irmus,
    try this
    serout PORTB.2,4,[$A0]

    if this ones work, that mean you not declare :

    INCLUDE "modedefs.bas" at the begining of your program

    It appear that in some case that you must write PORTB.x in uppercase too.

    Try also this :
    DEFINE CHAR_PACING 1000

    if this is not working tell me which PIC you use and how it is connected to RS-232 (with in serie resistor, thru an Max232...)


    let us know !!!

    regards
    Steve

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

  3. #3
    irmus's Avatar
    irmus Guest


    Did you find this post helpful? Yes | No

    Default

    I am using modedefs.bas . 4 - here it mode baudrate? I use max232 and pic16f84
    Thanks

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


    Did you find this post helpful? Yes | No

    Default

    when you don't include modedefs.bas SEROUT serpin,4,... is the same as SEROUT serpin,N2400...


    what is your taget device to receive $a0 ???
    $a0= 160 (decimal) = BLANK character in ASCII table

    maybe this is why.

    try PORTB.2,n2400,["hello ",#10,10,13]

    it suppose to display hello 10

    let me know
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    One other thing,
    it also seems that SEROUT don't understand $ before data. Only #.

    in your case if you really want to send $a0 use a variable

    ToSend var byte
    ToSend=$a0

    SEROUT PORTB.2,4,[ToSend]

    or
    SEROUT PORTB.2,4,[#ToSend] ; output will be 160
    Steve

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

  6. #6
    irmus's Avatar
    irmus Guest


    Did you find this post helpful? Yes | No

    Default

    I use comlite software and i can to see what i send to comport and what data receive from computer.
    Thanks, i try this SEROUT PORTB.2,4,[#ToSend] ; output will be 160

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


    Did you find this post helpful? Yes | No

    Default

    you're welcome.
    Steve

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

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. PIC18F4680 to PC via MAX232 (RS232 serial) no output
    By opticsteam1 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th April 2008, 20:39
  3. PC to PIC via RS232
    By Martin.... in forum mel PIC BASIC
    Replies: 3
    Last Post: - 15th September 2006, 10:44
  4. Waking a sleeping PIC
    By anj in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 19th May 2005, 01:51
  5. PIC to RS232 interface
    By thon in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th February 2004, 02:01

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