hello guys..
i have a big problem to be solve..
i am making robotic arm using PIC 16f784A as main controller.
but my robot movement was really quick.
so i trying to put delay time in my coding.
but i have no idea for now.
can anyone give some idea how i can solve my problem.
TQ so much!!
below is the coding for my pic controller using PIC Basic compiler:
Microcontroller programming using PICBasic Pro Software
TRISB = %00000000
TRISA = %00000001
DEFINE OSC 4
include "modedefs.bas"
Led VAR PORTA.4
Baud CON N2400
Com_In VAR PORTA.0
Com_Out var PORTA.1
Control VAR BYTE
Slider VAR byte
Sync var byte
I VAR BYTE
S0 var byte
S1 var byte
S2 VAR BYTE
S3 VAR BYTE
S4 VAR BYTE
S5 VAR BYTE
S6 VAR BYTE
S7 VAR BYTE
low PORTB.0
LOW PORTB.1
LOW PORTB.2
LOW PORTB.3
low PORTB.4
LOW PORTB.5
LOW PORTB.6
LOW PORTB.7
high led
S0 = 127
S1 = 111
S2 = 144
S3 = 65
S4 = 127
S5 = 127
S6 = 127
S7 = 127
Start:
serin Com_In, Baud, 7, Set_Pos, [255], Slider, Control
SEROUT Com_Out, Baud, [Slider,Control]
If Slider = 0 Then S0 = Control
If Slider = 1 Then
S1 = Control
S2 = 254 - S1
End If
If Slider = 2 Then S3 = Control
If Slider = 3 Then
S4 = Control
S5 = 254 - S4
End If
If Slider = 4 Then S6 = Control
If Slider = 5 Then S7 = Control
Set_Pos:
pulsout PORTB.0,S0
pulsout PORTB.1,S1
pulsout PORTB.2,S2
pulsout PORTB.3,S3
pulsout PORTB.4,S4
pulsout PORTB.5,S5
pulsout PORTB.6,S6
pulsout PORTB.7,S7
GoTo Start