serial communication between CMUcam and PIC 16F877


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2007
    Posts
    2

    Default serial communication between CMUcam and PIC 16F877

    hello...i have a problem to interface CMUcam and PIC 16F877...can anybody give the example coding to initialize Tx and Rx in PIC 16F877???...i want to make a serial communication between CMUcam and PIC 16F877...plzzz

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


    Did you find this post helpful? Yes | No

    Default

    I could give you the coding but I would not explain it as well as the PIC BASIC MANUAL does.

    The three options are:
    SERIN/OUT

    SERIN2/SEROUT2

    HSERIN/OUT
    Dave
    Always wear safety glasses while programming.

  3. #3
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gengkeys View Post
    hello...i have a problem to interface CMUcam and PIC 16F877...can anybody give the example coding to initialize Tx and Rx in PIC 16F877???...i want to make a serial communication between CMUcam and PIC 16F877...plzzz
    Have you tried the green manual, maybe the PIC datasheets, maybe a search on this site for serial code, maybe anything at all?

  4. #4
    Join Date
    Mar 2007
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    i've tried that ways but still have a problem...i still can't communicate CMUcam with the PIC...

    define osc 20

    include "modedefs.bas"
    main:
    serout portc.6,84,["L1 1",CR]
    serin portc.7,84,[(":")]

    debug "LED on ACK:received OK",CR

    pause 500

    serout portc.6,84,["L1 2",CR]
    serin portc.7,84,[(":")]

    debug "LED off ACK:received OK",CR

    pause 500
    goto main

    this coding has no error but it's not working...can you comment why it happen???...

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


    Did you find this post helpful? Yes | No

    Default

    Hi,
    I do not have my GREEN BOOK with me but if I remember correctly MODE 84 is used with SERIN2/SEROUT2, not SERIN/SEROUT.

    Also, how do you know the baud,parity,inverted or true ,driven or open,of your CMUcam.

    Fix the MODE problem and try playing with parity,inverted or true ,driven or open.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by gengkeys View Post
    i've tried that ways but still have a problem...i still can't communicate CMUcam with the PIC...

    define osc 20

    include "modedefs.bas"
    main:
    serout portc.6,84,["L1 1",CR]
    serin portc.7,84,[(":")]

    debug "LED on ACK:received OK",CR

    pause 500

    serout portc.6,<font color=red>84,</font color>,["L1 2",CR]
    serin portc.7,84,[(":")]

    debug "LED off ACK:received OK",CR

    pause 500
    goto main

    this coding has no error but it's not working...can you comment why it happen???...
    84 is a serout2 and serin2 command for 9600 baud not serin serout ( at least I do not see where it is supported) the CMUCam2 manual says to set communications to 115,200 , 8, 1, N. And to add \n to a received \r. See page 12, the old version says the same. So you might think good thoughts about using HSERIN. Here are the numbers fresh off mister_e's calculator:
    Code:
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 10  ' 115200 Baud @ -1.36%
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 10  ' 115200 Baud @ -1.36%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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