Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help with a section of simple code?

Status
Not open for further replies.

asmpic

New Member
I need to know if the following code will work for this situation: I need to insert 'entered_pass_code' starting at location 0x30 which I defined to be 'passcodes.' So when I do my first insertion it will be placed into 0x30 and my second will be in 0x31. After each insertion I need to increment 'num_pass_codes' to keep track of how big the list is and clear supervisor_mode. So to do this, I guess I need to use the FSR and INDF commands. But I'm not really good with those so I was wondering if someone can just glance over my code and see if it's doing what I need it to do.

Also, I don't need the code to continously insert 'entered_pass_code' into the list, only when I call the subroutine. So for example, I call super, it inserts 'entered_pass_code' into location 0x30, then it increments 'num_pass_codes' and clears supervisor_mode and finally calls the update subroutine which increments the counter_1 (which I'm hoping will actually increment the location of passcodes from 0x30 to 0x31 and so forth), so next time around it will already be at the next position in the list and just store the new 'entered_pass_code' there. counter_1 is defined and cleared at the beginning of the actual program so it will start off at zero.

Thanks!

Code:
super								; store the new passcode in list
	
    movlw     passcodes			
    addwf      counter_1,w		
    movwf     FSR			  
    movf       INDF,w	
    movwf     enter_pass_code 
;
    incf   num_pass_codes,f
    clrf   supervisor_mode
	 call   update
;
    return

update
	incf	counter_1,f
return
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top