Wednesday Jan 19:
The focus for this class was learning to interact with a pic micro-controller through a USB to serial output. In the photo below, the black 8 pin chip is the pic micro-controller of type 08M.
Part no. 12f683. The white wire at the top of the photograph is the Tx to computer wire, the grey wire on the left side of the photo is the communications FROM the computer, and it is wired in series with a resistor to prevent an overload of the communications pin.
Setting up the board was painless, but getting the serial communication to work took the bulk of the head scratching.

http://www.rev-ed.co.uk/picaxe/software.htm
The rest of the evening was spent trying to get this servo PAN/TILT platform to interface with the pic micro-controller.
The PIC has built in syntax for controlling servo motors;
The code I used to move the servo by changing the amount of light hitting a LDR (Light Dependent resistor) is shown below.
============================================
init: servo 2,125
main:
readadc 4, b0
serout 0, N2400, (#b0)
serout 0, N2400, (10,13)
if b0> 95 then position
if b0< 96 then outdown
goto main
position:
servopos 2, b0
pause 200
goto main
outdown:
servopos 2, 95
pause 200
goto main
=====================================
No comments:
Post a Comment