It is currently Tue May 21, 2013 7:10 pm

All times are UTC + 10 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Code misunderstanding
PostPosted: Sat Oct 30, 2010 8:53 am 
Offline
decided to stick around...
decided to stick around...

Joined: Tue Jun 08, 2010 12:14 pm
Posts: 32
Could someone please explain to me what the numbers after each bsf/bcf command represent.

Thanks

Code:
draw_ball            ;   this routine draws the ball on the screen
   movf ball_y, w      ;   copy our ball_y co-ordinate to w
   movwf PORTB         ;   and then to portb (our data bus)
   bsf PORTA, 2      ;   now latch this 8-bits to the green 74373
   bcf PORTA, 2      ;   and now close the latches
   movf ball_x, w      ;   copy ball_x co-ordinate to w
   movwf PORTB         ;   then to port b (our data bus)
   bsf PORTA, 4      ;   now latch this 8-bits to the COLUMN data 74373
   bcf PORTA, 4      ;   and close the latches
   bcf PORTA, 3      ;   enable both the green and column 74373 outputs
   bcf PORTA, 6      ;   3 is green and 6 is column data
   call delay         ;   hold this data on the screen for a split second
   bsf PORTA, 3      ;   close both green and column outputs
   bsf PORTA, 6      ;   3 is green and 6 is column data
   return            ;   and return to the main program


Top
 Profile  
 
 Post subject: Re: Code misunderstanding
PostPosted: Sat Oct 30, 2010 10:10 am 
Offline
semi-newbie
semi-newbie

Joined: Mon Sep 13, 2010 11:06 am
Posts: 24
Location: Central US
The number after each "bcf/bsf" is the PORT pin.

So, "bsf PORTA, 4" represents setting or turning on (high) PORTA - Pin 4 or RA4.

I hope that's what you're asking, if not, let me know...

darrin


Top
 Profile  
 
 Post subject: Re: Code misunderstanding
PostPosted: Sat Oct 30, 2010 1:11 pm 
Offline
decided to stick around...
decided to stick around...

Joined: Tue Jun 08, 2010 12:14 pm
Posts: 32
Thank you darrin :D


Top
 Profile  
 
 Post subject: Re: Code misunderstanding
PostPosted: Sun Oct 31, 2010 2:12 pm 
Offline
Site Admin
Site Admin
User avatar

Joined: Fri Mar 26, 2010 10:30 pm
Posts: 1860
Nice clarification!


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

All times are UTC + 10 hours


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
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme made by Keenen Wheeler