Okay; finally, it works.
Here is my code I had to correct according to Sougata's example.
ANSEL or not, it works.Code:' Fuses @ DEVICE PIC16F88,INTRC_OSC_NOCLKOUT @ DEVICE PIC16F88,PROTECT_OFF @ DEVICE PIC16F88,WDT_OFF @ DEVICE PIC16F88,PWRT_ON @ DEVICE PIC16F88,MCLR_ON @ DEVICE PIC16F88,BOD_OFF @ DEVICE PIC16F88,LVP_OFF @ DEVICE PIC16F88,CPD_OFF @ DEVICE PIC16F88,DEBUG_OFF @ DEVICE PIC16F88,CCPMX_OFF '------------------------------------------------------------------------------- ' Registers 76543210 OSCCON = %01100000 '4MHz OPTION_REG = %10000000 'D I S A B L E PORTB's Pull-Ups for buttons 'ANSEL = %00000000 'Disable Analogue Inputs TRISA = %00000000 'Inputs/Outputs TRISB = %00100000 'Inputs/Outputs '------------------------------------------------------------------------------- ' Variables Led0 var PORTA.0 Led1 var PORTA.1 HiLow var PORTB.5 'this port is TTL only InOut var TRISB.5 Time var byte time = 2 '------------------------------------------------------------------------------- ' Program MAIN: inout = 0 hilow = 0 pause time inout = 1 pause time if hilow = 1 then led1 = 1 : goto main led1 = 0 inout = 0 hilow = 1 pause time inout = 1 if hilow = 0 then led0 = 1 : goto main led0 = 0 Goto MAIN end
I changed the 0,1µF cap for a 0,01µF and reduced the pause time to 2 so it goes drastically faster.
Thanks a lot for your patience.
In fact, I was stuck in my mind thinking this problem would have to be resolved another way than by a software routine...




Bookmarks