View Full Version : serial communication between CMUcam and PIC 16F877
gengkeys
- 28th March 2007, 05:39
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
mackrackit
- 28th March 2007, 09:14
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
skimask
- 28th March 2007, 13:36
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?
gengkeys
- 30th March 2007, 05:07
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???...
mackrackit
- 30th March 2007, 06:40
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.
Archangel
- 30th March 2007, 06:43
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:
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
Powered by vBulletin® Version 4.1.7 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.