Page 1 of 1

PIC16F1937 PORTA ISSUE I THINK help

Posted: Wed Jan 11, 2017 11:19 pm
by chloe4479
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

Re: PIC16F1937 PORTA ISSUE I THINK help

Posted: Wed Jan 11, 2017 11:52 pm
by medelec35
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.

Re: PIC16F1937 PORTA ISSUE I THINK help

Posted: Tue Feb 07, 2017 12:00 am
by chloe4479
Thanks Martin

You have a been a great help as always

Chloe