[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 580: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 636: sizeof(): Parameter must be an array or an object that implements Countable
Brads Electronic Projects Forum • Code misunderstanding
Page 1 of 1

Code misunderstanding

Posted: Sat Oct 30, 2010 8:53 am
by tgraz34
Could someone please explain to me what the numbers after each bsf/bcf command represent.

Thanks

Code: Select all

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

Re: Code misunderstanding

Posted: Sat Oct 30, 2010 10:10 am
by elementalrage
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

Re: Code misunderstanding

Posted: Sat Oct 30, 2010 1:11 pm
by tgraz34
Thank you darrin :D

Re: Code misunderstanding

Posted: Sun Oct 31, 2010 2:12 pm
by brad
Nice clarification!