Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 28th January 2009, 05:27 PM   #16
Default

Quote:
Originally Posted by Nigel Goodwin View Post
And I've also got two Cybots, and a website about them!.

That try was wrong -easy way to do it:

Read the entire port to W.

Transfer W to a GPR.

Check each of the bits in the GPR using either BTFSS or BTFSC, depending which way you're testing.

Also, use the include file names, I've no idea what 'Status, 2' means?, the correct way would be 'Status, Z' (assuming 2 is Z?).

Hi, ive done that, it still doesnt work. did some debuging and saw the problem.

I tried this:

test MOVF cPORTA,W
ANDLW code1
MOVWF PORTB
GOTO test

and for some reason what is in code1 is totally ignored. No matter what If i press button 0 light 0 on B lights. Same for button 1. However 2 and 3 never work no matter what. Whatever you set the codeto, 1 and 2 pass the "and" check and nothing else does...confusing.

Can you remember the RealCybot site?

BTW, yes 2 is zero flag.

Last edited by adamscybot; 28th January 2009 at 05:29 PM.
adamscybot is offline  
Old 28th January 2009, 05:38 PM   #17
Default

My bad, used ANDLW code1 which obviously wont work.

Working code:

Code1 MOVF PORTA,W
BTFSC STATUS,2
MOVF PORTA,W
ANDWF code1,0
MOVWF temp
CALL Flag
CALL Release
RETURN

It works!!!!!!!! Flag checks every bit in temp.

My problems are solved. Thanks to everyone.
adamscybot is offline  
Old 28th January 2009, 06:09 PM   #18
Default

Quote:
Originally Posted by adamscybot View Post
My bad, used ANDLW code1 which obviously wont work.

Working code:
Code:
Code1 
    MOVF    PORTA, W
    BTFSC    STATUS, 2
    MOVF    PORTA, W
    ANDWF    code1, 0
    MOVWF    temp
    CALL    Flag
    CALL    Release
    RETURN
It works!!!!!!!! Flag checks every bit in temp.

My problems are solved. Thanks to everyone.

Sorry, I got here so late this morning. I was just working out how to explain (don't do enough assembler these days...) but I see you got it, on your own. Great job!

Now I can get some more coffee!

PS. Here is a tip for when you post code on here:
Surround it with [code] and [/code] tags

Last edited by BeeBop; 28th January 2009 at 06:15 PM.
BeeBop is offline  
Reply

Tags
alarm, burglar, checking, inputs

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
Burglar alarm help. compute_a_nerd Electronic Projects Design/Ideas/Reviews 10 13th January 2009 03:14 PM
burglar alarm yoursoninoz Electronic Projects Design/Ideas/Reviews 3 23rd March 2007 04:53 PM
Burglar Alarm tauraim Electronic Projects Design/Ideas/Reviews 6 1st March 2007 11:05 AM
Burglar alarm madmikejt12 Chit-Chat 6 21st October 2006 12:40 PM
burglar alarm chriz Electronic Projects Design/Ideas/Reviews 1 21st June 2005 10:17 PM



All times are GMT. The time now is 01:02 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker