Then:
The reason the old PORTB.1 worked is that little scootch of additional time between OHI=0 and OLO=1 caused by the GOTO?
Were there Olympic Gold for PBP help, you'd get it!
Then:
The reason the old PORTB.1 worked is that little scootch of additional time between OHI=0 and OLO=1 caused by the GOTO?
Were there Olympic Gold for PBP help, you'd get it!
Russ
N0EVC, xWB6ONT, xWN6ONT
"Easy to use" is easy to say.
I came across the R-M-W issue today, I thought I was losing my mind. I am glad I searched the archive for 16F1827 because for the life of me I couldn't get the darn ports to set and reset after a pause statement.
Has this problem been reported? Will it be fixed in the next PBP version update?
I am sorry for the 20 questions, it is just that I spent 2hrs troubleshooting my hardware. When that didn't pan out I dove into getting rudimentary features to work before seeking help. All in all a dang port toggle ate up 4hrs of my day...sigh.
Nick![]()
Last edited by Macgman2000; - 19th June 2010 at 01:23.
It's not an issue with PBP.Has this problem been reported? Will it be fixed in the next PBP version update?
It's just the way the PIC Hardware works.
And I assume it's why Microchip eventually added the LATx registers in the 18F's, and now the 16F1's.
Just keep it in mind when you try to change pin states really fast and they don't work (or they affect other pins in the same port).
Usually a minor change can fix it, even with 16F's.
DT
Thanks Darrel for the explanation. I guess it's good I cut my teeth on this problem early on. My next (week) project is using an 18F.....good to know what I am in store for.
Nick![]()
Hello Darrel,
I have some more weirdness going on. I got my code to work, but not the way I want it to.
When I read PortB using LatB, I can't seem to detect a set bit on B1. When I write directly to the
variable in my case statement I can step through the values and the outputs are correct. I can't
what is wrong with what I have. Code below.
ASM
__config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
__config _CONFIG2, _PLLEN_OFF & _LVP_OFF & _LVP_OFF & _STVREN_OFF
ENDASM
DEFINE OSC 8
;************************************************* ******************************
;************************************************* ******************************
; System hardware configuration
;************************************************* ******************************
;************************************************* ******************************
OSCCON = %01110000 ' 8MHz internal
ANSELA = %00000000 ' all digital. A/D disabled
ANSELB = %00000000
TRISB = %00111111 ' set port directions 0 = output, 1 = input
TRISA = %00000000
Servo1 var byte
Servo2 var byte
srv2 VAR LATA.1
srv1 VAR LATA.0
PrtB VAR LATB
Program_init:
PortA = 0
POrtB = 0
Main_Loop:
Servo1 = PrtB and %00000111
gosub Servo_update1
Servo2 = PrtB and %00111000
gosub servo_update2
pause 10
goto main_loop
Servo_update1:
select case Servo1
case 0
srv1 = 1 : pauseus 1000 : srv1 = 0
CASE 1
srv1 = 1 : pauseus 1143 : srv1 = 0
case 2
srv1 = 1 : pauseus 1286 : srv1 = 0
case 3
srv1 = 1 : pauseus 1429 : srv1 = 0
CASE 4
srv1 = 1 : pauseus 1572 : srv1 = 0
case 5
srv1 = 1 : pauseus 1715 : srv1 = 0
Case 6
srv1 = 1 : pauseus 1858 : srv1 = 0
Case 7
srv1 = 1 : pauseus 2000 : srv1 = 0
END SELECT
return
Servo_update2:
select case Servo2
case 0
srv2 = 1 : pauseus 1000 : srv2 = 0
CASE 8
srv2 = 1 : pauseus 1143 : srv2 = 0
case 16
srv2 = 1 : pauseus 1286 : srv2 = 0
case 24
srv2 = 1 : pauseus 1429 : srv2 = 0
CASE 32
srv2 = 1 : pauseus 1572 : srv2 = 0
case 40
srv2 = 1 : pauseus 1715 : srv2 = 0
Case 48
srv2 = 1 : pauseus 1858 : srv2 = 0
Case 56
srv2 = 1 : pauseus 2000 : srv2 = 0
END SELECT
return
Bookmarks