Is cw_ccw in Bank 0 or Bank 1 ? :-) greetings Martin ;********************************************** ;** name: Martin Schaefer ** ;** company: elektronik 21 GmbH, Germany ** ;** e-mail: schaefer@elektronik21.de ** ;********************************************** > -----Original Message----- > From: Chunhee Song [mailto:chunhee@lpl.arizona.edu] > Sent: Tuesday, June 20, 2000 5:51 PM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: zero flag is never set!!! > > > thanks for your reply, Martin. > > But still zero flag is never set. > I spent more than 4 hours for this part but didn't get right. > I am very > sure I got 'c' in rxreg register. I tested it. Here is some > more specific > code. > > ** cw_ccw has 'c' ** > bcf status, rp0 ; cw_ccw is in bank 0 > movlw 'c' > xorwf cw_ccw, w ; 0x63 is "c" > btfss status, z > goto coclockwise ; zero flag occurred > clockwise > bsf STATUS,RP0 ; select page 1 registers > bcf trisc, 2 > bsf trisc, 3 ; high > bcf trisc, 4 ; low > goto dirok > coclockwise > bsf STATUS,RP0 ; select page 1 registers > bcf trisc, 2 > bcf trisc, 3 ; low > bsf trisc, 4 ; high > dirok > bcf STATUS,RP0 ; select page 0 registers > movlw 0x01 ; prescaler 1:4 > movwf t2con > bsf T2CON,tmr2on ; enable timer2 > movlw 0x3f ; pwm mode > movwf CCP1CON > > This code always ends up heading to coclckwise even though > cw_ccw has 'c'. > Any idea??? > > On Tue, 20 Jun 2000, Martin Hill wrote: > > > > > > > I was trying to get a character 'c' from rxreg and if it is 'c' > > > my program has to do something. > > > > > > 'c' i saved in temp register. > > > ;I already did bit processing in case, > > > movf temp, w > > > andlw oxff > > > movwf temp; > > > > I can't really see the point of this section. Surely it > just moves temp > > to w and then back again. > > > > > > > > > ..... > > > movlw 0x63 ; since c is 0x63 in hexadecimal > > > xorwf temp, w > > > btfss status, z > > > goto dosomething > > > dosometing.... > > > > Apart from the fact you are executing the same code irrespective of > > the state of Z this looks O.K. The only thing that could > be wrong is if > > c is not 0x63. I would use. > > > > movlw 'c' > > xorwf temp, w > > btfss status, z > > goto dosomething > > dosometingelse.... > > ;whatever you do when it is a 'c' > > > > dosomething > > ;whatever you do when it isn't a 'c' > > > > > > Martin > > >