I am trying g to run this programe which works if I don't use the port a switch, but as soon as I include the switch noting happens.
Basically as soon as porta,0 switch is pressed the count on port b led begins.
However noting happens
What have I done wrong
Asm file uploaded
Chloe
PIC16F1937 PORTA ISSUE I THINK help
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: PIC16F1937 PORTA ISSUE I THINK help
Hi Chloe,
Attached is a modified ASM file.
The reason why your ASM is not working is because by default with 16F1937 all analogue pins are enabled i.e. port A0 being one of them.
If an analogue pin is enabled then it will not work as a digital input,
So I added BANK3 since to disable an analogue pin you need to clear the corresponding bit of ANSELA (ANalogue SELect port A) Register at location H'18C' (BANK3)
I have also added a delay or LEDs will count far too rapidly.
Martin
Edit: Moved Topic to a more appropriate section.
Attached is a modified ASM file.
The reason why your ASM is not working is because by default with 16F1937 all analogue pins are enabled i.e. port A0 being one of them.
If an analogue pin is enabled then it will not work as a digital input,
So I added BANK3 since to disable an analogue pin you need to clear the corresponding bit of ANSELA (ANalogue SELect port A) Register at location H'18C' (BANK3)
I have also added a delay or LEDs will count far too rapidly.
Martin
Edit: Moved Topic to a more appropriate section.
- Attachments
-
- TUT8NEW.ASM
- (2.4 KiB) Downloaded 554 times
Martin