I bought PIC Microcontroller Project Book for PICBasic and PICBasic Pro.
Attached is my schematic drawing of what I am working on. The code and schematic come right out of the book on pages 173 fig 12-10 and Source is off page 175 program 12.6.
Everything works perfect for turning on and off LED's. I have no idea what else I can do with this program. I see a lot of uses I would like to do but and unsure how to apply them.
Example -
On one of the input pins on the 74LS165 have a variable POT and read it's value. Then have a servo move according to how far the POT has moved on an output pin on the 74LS164.
That is something I would like to make happen, but and unsure what would need to be changed in the code to make that happen.
Any help would be appreciated. Thanks
CODE:
Code:include "MODEDEFS.BAS" B0 var byte 'initialize ports TRISB = 4 'set port B pin 2 = input/rest output low portb.5 'set CLK low high portb.4 'set CLK inhibit high high portb.3 'bring shift/load high start: gosub serial_in 'Get number from 74LS165 serout portb.7, t9600, [$fe,1," ____ ", #B0] pause 1000 gosub serial_out 'send it out on 74LS164 serout portb.7, t9600, [$fe,1," ____ ", #B0] pause 1000 'wait and see what happens goto start 'do it again serial_in: pulsout portb.3,1 'bring shift/load down momentarily low portb.4 'bring clk inhibit low B0.7 = portb.2 'load bit into B0 pulsout portb.5,1 'bring clk pin high, then low B0.6 = portb.2 'same as above pulsout portb.5,1 B0.5 = portb.2 pulsout portb.5,1 B0.4 = portb.2 pulsout portb.5,1 B0.3 = portb.2 pulsout portb.5,1 B0.2 = portb.2 pulsout portb.5,1 B0.1 = portb.2 pulsout portb.5,1 B0.0 = portb.2 high portb.4 'bring clk inhibit high return serial_out: portb.0 = B0.7 pulsout portb.1,1 portb.0 = B0.6 pulsout portb.1,1 portb.0 = B0.5 pulsout portb.1,1 portb.0 = B0.4 pulsout portb.1,1 portb.0 = B0.3 pulsout portb.1,1 portb.0 = B0.2 pulsout portb.1,1 portb.0 = B0.1 pulsout portb.1,1 portb.0 = B0.0 pulsout portb.1,1 portb.1 = 0 return




Bookmarks