How does serin function?


Closed Thread
Results 1 to 4 of 4
  1. #1
    a_critchlow's Avatar
    a_critchlow Guest

    Question How does serin function?

    Hi, i am new to this forum so.. hi.
    I was wondering how the serin command functions.

    I know the PIC executes line by line instructions, so with the serin command does the PIC wait to receive so many bits before executing the next instruction. The problem being say if i want to send 8bits and 2 bits are lost, will the PIC wait untill it receives another 2 bits to make up for the lost ones or will it clock to empty spaces and move onto the next instruction?

    Secondly does anyone know what the encoder and decoder chip does? I want to bypass this and go straight from the RF module to the PIC. (The PIC will act as to whether or not it will receive the data or not). Are there any problems with this?



    Thank you to anyone who can help.

  2. #2
    Join Date
    Aug 2005
    Posts
    42

    Default

    Serial data is just 1 and 0's.

    So if receving say a byte the the serial packet will have a start bit, 8 bits of data, parity bit and then Stop bits.

    But it is all done on timing, so if the pic does not receive a say a 1 within the time delay set by the baud rate between bits, then it will just take it as being a 0

    This is where you need to use the parity bit and do a calculation against the 8 data bits received.
    So basically receive your 8 bits and your parity bit, do the calculation and if incorrect request the byte again from the device sending the data.

    Regards

    Sean.
    *********************
    http://www.cncdudez.co.uk
    *********************

  3. #3
    a_critchlow's Avatar
    a_critchlow Guest

    Post parity bit

    hi thanks for that, could you elaborate on the parity bit? is this either a 1 or a zero? what calculation is there? i am planning on using 8N1 so it isnt vital but the parity may come in useful! Especially for fault tollerence.





    thanks for your time,
    andrew.

  4. #4
    Join Date
    Aug 2005
    Posts
    42

    Default

    The Parity bit can be either odd or even.

    Check this link for more details:

    http://www.lammertbies.nl/comm/info/...pecs.html#erro

    Regards

    Sean.
    *********************
    http://www.cncdudez.co.uk
    *********************

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. serin question?
    By sachymo in forum General
    Replies: 5
    Last Post: - 27th July 2008, 10:04
  4. Problem with PBP interrupt and Serin, please help
    By rgregor in forum mel PIC BASIC
    Replies: 0
    Last Post: - 22nd August 2006, 19:02
  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