It is currently Thu Dec 18, 2014 9:35 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: K8048 examples
PostPosted: Mon Nov 09, 2009 12:18 pm 
Offline
Member
Member

Joined: Thu Jan 03, 2008 10:40 am
Posts: 10
My K8048 is working fine with the supplied examples, and I'm getting a little understanding of the assemblerlanguage.
One thing I do not understand. I would expect that the testswitches are read as a binairy code of PortA, so Sw1=1 (B'00000001'), Sw2=2, SW3=4 and SW4=8 (B'00001000')
But in the Demo2 example is stated:
;INPUTS
SW1 EQU H'00' ;SW1 is triggering RA0
SW2 EQU H'01' ;SW2 is triggering RA1
SW3 EQU H'02' ;SW3 is triggering RA2
SW4 EQU H'03' ;SW4 is triggering RA3
So this puzzles me. Who can explain this?
And how can I use 2 buttons pressed simultaneously.

Thanks, Kees


Top
 Profile  
 
 Post subject: Re: K8048 examples
PostPosted: Mon Nov 09, 2009 12:29 pm 
Offline
User avatar
Velleman Support
Velleman Support

Joined: Fri Dec 08, 2006 8:07 am
Posts: 6896
Location: Belgium
Answering such questions is beyond the scope of this forum, but as a one-time favour:

MPLAB allows you to assign a name to each bit.
In this case:

PortA bit0: SW1
PortA bit1: SW2
etc...

Then you can write e.g. BTFSS PORTA,SW1 instead of BTFSS PORTA,0


Top
 Profile  
 
 Post subject: Re: K8048 examples
PostPosted: Mon Nov 09, 2009 2:27 pm 
Offline
Member
Member

Joined: Thu Jan 03, 2008 10:40 am
Posts: 10
Thanks for the answer. I think I understand it (a little). In fact you could say 'What's in a name!'.
I will play around with the assignments and maybe I'll see the light.

Grtz, Kees


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group