how to use SERIN???


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    45

    Default how to use SERIN???

    i try to send data from vb to pic16f877a using serial port.can i use those code below???

    code:

    SO con 0 ' Define serial out pin
    SI con 1 ' Define serial in pin
    N2400 con 4 ' Set serial mode
    B0 var byte

    loop:
    Serin SI,N2400,B0 ' B0 = input character
    If (B0 < "a") or (B0 > "z") Then print ' If lower case, convert to upper
    B0 = B0 - $20

    print:
    Serout SO,N2400,[B0] ' Send character
    Goto loop ' Forever

    can someone teach me how to setting the:

    SO con 0 ' Define serial out pin
    SI con 1 ' Define serial in pin
    N2400 con 4 ' Set serial mode
    B0 var byte

    i use pic16f877a which the rx=portc.7 and tx=portc.6...

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

    Default

    If you want to name a pin use var
    Code:
    SO VAR PORT?.?
    And you will need [] in your SERIN statement.

    And if you are using the software serial (SERIN, SERIN2) then any pin will work if it is digital, pretty much.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2008
    Posts
    45

    Default

    for example:

    SO VAR portc.6 'tx pin for pic16f877a
    SI VAR portc.7 'rx pin for pic16f877a

    SERIN SI,N2400,["A"],B0 'Wait until the character “A” is received serially

    am i correct???

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

    Default

    That should do the trick
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2008
    Posts
    45

    Default

    thanx...i will try it.

Similar Threads

  1. Serin EEPROM Programmer
    By dirtbiker5627 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 24th February 2010, 23:48
  2. PIC16f877 code crosses boundary @800h
    By inventosrl in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 6th April 2009, 22:03
  3. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  4. Serin with low voltage
    By f_lez in forum General
    Replies: 3
    Last Post: - 21st August 2006, 11:52
  5. SerIn and SerOut
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 21st July 2004, 15:54

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