questions on two ports was used.
There is production winkers.
The operation of HPWM doesn't move normally.
The operation only of one port is something strange though it seems
to move.
The second port doesn't operate.
The operation of usual HI and LOW is normal.
I do not understand the cause though it is thought that the part
related to HPWM is bad because the blinking mode becomes a defective
operation, too, when changing it from the PWM mode into the blinking mode.
It buys and it experiments on PIC16F616 that HPWM is a lot of.
Please teach if there is what becomes some references.
code:
'Control of Winkers
PORTC=0
TRISC=0
ADCON0 = 0
ANSEL = 0
DEFINE HPWM2_TMR 2
Duty var byte
T VAR WORD
INPA var byte
IL var PORTA.1
IR var PORTA.2
SELSW var PORTA.4
LEDL VAR PORTC.5
LEDR VAR PORTC.4
t=1000
Start:
TRISA = %11111111
INPA = PORTA
IF INPA=%00000010 then gosub LPWM
IF INPA=%00000100 THEN GOSUB RPWM
IF INPA=%00010010 then gosub LPulse
IF INPA=%00010100 THEN GOSUB RPulse
' bit5 modeSW
goto Start
LPWM: 'Lch PWMOUT
for duty =0 to 255 step 2
hpwm 2,DUTY,1000
next
for duty =255 to 0 step -2
hpwm 2,DUTY,1000
next
return
RPWM: 'Rch PWMOUT
For duty =0 to 255 step 2
hpwm 1,DUTY,2000
next
for duty =255 to 0 step -2
hpwm 1,DUTY,2000
next
return
'Lch out HiLow
LPulse:
HIGH LEDL
PAUSE T
LOW LEDL
PAUSE T
return
'Rch out HiLow
RPulse:
HIGH LEDR
PAUSE T
LOW LEDR
PAUSE T
return
end
Bookmarks