serial to PIC


Closed Thread
Results 1 to 23 of 23

Thread: serial to PIC

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Posts
    15

    Default serial to PIC

    I am picbasic pro user
    I made this program to send serial signal from PIC to PC

    define osc 4
    include "bs2defs.bas"

    key1 var porta.2

    findkey:
    if key1 = 0 then press1

    press1:
    SEROUT PORTa.0,N9600,["KINDOWS 1 "]
    goto findkey

    by this program if I make port a.2 = 0 the program send this [kindows] as a serial signal from port a.0.

    Now I need If I send serial signal from PC to PIC
    If I send this [k] from PC to PIC and then PIC make any port like RA1 high to active a relay.
    Please some one help me soon.

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


    Did you find this post helpful? Yes | No

    Default

    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Not sure of the PIC you are using...but if it has analog on it the above should help.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jul 2009
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    So So but I can't find the answer on it

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


    Did you find this post helpful? Yes | No

    Default Tesla

    I misread your post before...
    Code:
     SERIN PORT?.?,N9600,[K],myVar
    IF myVar = 3 THEN gosomeplace or dosomething
    Send K and another value from the PC " K3 " for example.
    The PIC will wait for the "K". When the PIC receives a "K" the next character will be written to myVar.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2009
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Hi..
    thank u alot I lik [Always wear safety glasses while programming]

    I forget to tell u I am new in PICBASIC PRO now only 2 weeks. I think the code will be like this:
    define osc 4
    include "bs2defs.bas"

    wait:
    SERIN PORTa.1,N9600,["K3"],myVar
    IF myVar = 3 THEN out

    out:
    HIGH PORTb.7
    PAUSE 300
    LOW PORTb.7
    goto wait

    but I cant understand [myvar]. How I can decide it???
    Thank u in advance.

  6. #6
    Join Date
    Jul 2009
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    its not working

Similar Threads

  1. PIC to PIC "wired" serial one-way communication - SERIN2/SEROUT2
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 14th April 2008, 20:02
  2. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 07:57
  3. Serial Com Pic to Pic
    By uludere72 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st May 2005, 10:06
  4. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14
  5. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 15:45

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