PIC16F1937 PORTA ISSUE I THINK help

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
User avatar
chloe4479
Posts: 19
Joined: Fri Jan 06, 2017 4:19 pm
Has thanked: 10 times
Been thanked: 5 times
Contact:

PIC16F1937 PORTA ISSUE I THINK help

Post 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
Attachments
TUT8NEW.ASM
(2.19 KiB) Downloaded 554 times

medelec35
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

Post 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.
Attachments
TUT8NEW.ASM
(2.4 KiB) Downloaded 543 times
Martin

User avatar
chloe4479
Posts: 19
Joined: Fri Jan 06, 2017 4:19 pm
Has thanked: 10 times
Been thanked: 5 times
Contact:

Re: PIC16F1937 PORTA ISSUE I THINK help

Post by chloe4479 »

Thanks Martin

You have a been a great help as always

Chloe

Post Reply