serial to PIC


Closed Thread
Results 1 to 23 of 23

Thread: serial to PIC

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Code:
    define osc 4
    include "bs2defs.bas"
    
    wait:
    
    SERIN PORTa.1,N9600,["K"],myVar
    
    IF myVar = 51 THEN out ' Ascii 51 = decimal 3 (When you type 3 myvar will be 51)
    
    goto Wait ' this line is esential otherwise any key will activate the function 
    
    out:
    
    HIGH PORTb.7
    
    PAUSE 300
    
    LOW PORTb.7
    
    goto wait

    This is the code that Dave suggested.

    From keyboard type K3 to activate portB.7 for 300 millisecs.


    Al.
    Last edited by aratti; - 11th July 2009 at 17:35.
    All progress began with an idea

  2. #2
    Join Date
    Jul 2009
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Now I am using windows hyper terminal to send serial signal. When I am sending [k] from it the terminal send it in ascii or in hex??
    I think send it in Ascii!!!

    so I have to send [k] or [k3]??

    and becuse I am new in PICBASIC PRO I can't understand how I can decide [myvar]
    Can u help ??

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


    Did you find this post helpful? Yes | No

    Default

    Read the post from Al very carefully. He has everything there you need.

    Not sure what you mean by deciding "myVar". It is just a variable
    to store a value. The serin command will write data to that
    variable and the if/then part checks to see what the value is.

    Oh, the safety glasses thing. It is not a joke.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jul 2009
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Do you think this code will working fine??

    define osc 4
    include "bs2defs.bas"

    wating:
    SERIN PORTa.1,N9600,["K"],b1

    IF b1 = 51 THEN out ' Ascii 51 = decimal 3 (When you type 3 myvar will be 51)

    goto wating ' this line is esential otherwise any key will activate the function

    out:

    HIGH PORTb.7

    PAUSE 300

    LOW PORTb.7

    goto wating
    -----------------------------------------------
    I am using PIC16F84a and port RA! Connected to 22k ohm then to the pc serial port. And I am using windows hyper terminal to send the serial signal now my question number tow is what I have to send [k3] or [3] or[k] or 51???

    good glass:)

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


    Did you find this post helpful? Yes | No

    Default

    Send K3...
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Jul 2009
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Its not working
    PLZ help me

  7. #7
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    check if your wiring is the same as the attached schematic.

    Al.
    Attached Images Attached Images  
    All progress began with an idea

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, 21:02
  2. Automatic VB6 to pic serial connection
    By arniepj in forum Code Examples
    Replies: 13
    Last Post: - 10th January 2008, 08:57
  3. Serial Com Pic to Pic
    By uludere72 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 31st May 2005, 11:06
  4. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th March 2005, 00:14
  5. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 16: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