1 Mar 01:11
[PIC] RS232 to PIC16F628 to DC Motor
bathini <wozamfethu <at> yahoo.es>
2009-03-01 00:11:02 GMT
2009-03-01 00:11:02 GMT
Friends I am having a hard time programming in assembly. I am going to send a packet via PC serial port to control a small DC motor via the PIC16F628 microcontroller. The packet is going to be 4 bytes(4 X 8bit). Byte 1 is preamble and should all be 8 ones(11111111) Byte 2 is address of motor(Can make up any number) Byte 3 is data byte, 4 bits for speed and 1 bit for direction Byte 4 is for error detection, if the address of the motor is not the one mentioned on Byte 2, or preamble is not all ones, then drop the packet. So I imagine you will OR the packet. If the packet passes the above conditions (Byte 1 and Byte 2, byte 3), RA0 pin will go high and the motor will spin in one direction, if RA0 is a low, the motor will spin in the other direction Byte 3 will utilize the CCP/PWM module of the PIC16F628 to alter speed, so that is pin 9 on the PIC. This is quite tricky for me. Any help? Here is a code I got from www.piclist.com ;-----------------------------------------------------------------------; ; ALPHABET.ASM Send and Receive serially at 1200 baud to PC ; ;-----------------------------------------------------------------------;(Continue reading)
RSS Feed