|
-
Apr 3rd, 2007, 07:17 PM
#1
Thread Starter
New Member
Picbasic serial commands
I am interfacing with a PIC16F84 using the RS232 serial port. I am using Picbasic to compile the software for the microcontroller.
currently this is my MCU code -
Code:
Include "modedefs.bas" ' Include serial modes
si var PORTA.0
pos var byte
servo var byte
cont var byte
trisb = 0 'make all of port B outputs
start:
serin si,N2400,servo,pos
for cont = 0 to 50
pulsout servo,pos
pause 15
next cont
goto start
It is to control an array of servo motors.
There is a problem with the code, in that when i send the servo and pos data to the chip, it pulses the servos 50 at the required rate. Then it stops and the servo can move out of place again.
Is there any way i can create a loop that checks for any data coming in. If not it pulses it again before looping back, if there is data, it collects it, changes the values of the variables accordingly, luses, and then loops.
Thanks
Harry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|