Hello, I tried your code Dag. But since i have some other routines running i see unwanted behaviour. So i try to switch that off first. The bit pattern coming out now looks like 00110011001101010100110011001100 and repeats over and over again. grtz Simon --- Dag Bakken wrote: > Sorry about that... I actually managed to > misunderstand. This is a > correction. A circular buffer would be something > like this, and very > much like another reply you got in asm. > > W=rr(pwm); > led1=Carry; > pwm=rr(pwm); > > This should generate something like: > > RRF pwm,W ; Get bit > BTFSS Carry ; Output it > BCF led1 > BTFSC Carry > BSF led1 > RRF pwm,F ; Re-insert > > It doesn't really matter. You can just as well do > something like > this: > > W=rr(pwm); > pwm=rr(pwm); > led1=pwm.3; > > > Dag S > > > STdF> Hello, > > STdF> Thanks for the replies. > STdF> Following Dag's hint, since i use CC5x, i > found out it > STdF> did not work. > STdF> In MPASM i tried the piece of code which is > shown > STdF> below. > > STdF> start clrw > STdF> CLRF PORTA > STdF> BSF STATUS, RP0 > STdF> MOVLW 0x00 > STdF> MOVWF TRISA > STdF> BSF STATUS, C > STdF> BCF STATUS, RP0 > STdF> MOVLW 0x55 > STdF> MOVWF pwm > > > STdF> main BTFSS pwm,0 > STdF> BCF PORTA,0 > STdF> BTFSC pwm,0 > STdF> BSF PORTA,0 > > STdF> rrf pwm,1 > STdF> goto main > STdF> ; > STdF> END > > STdF> So i filled pwm with 0xAA. > STdF> I'd expected a bit pattern on the output which > should > STdF> look like 01010101. > STdF> What i see happening in MPASM, when i trace > pwm, is > STdF> 0xAA, 0x55, 0x2A, 0x95, 0x4A, 0xA5, 0x52, > 0xA9, 0x54, > STdF> 0xAA. And this continues since pwm is not > affected. > STdF> So that is OK. > > STdF> However when i try it on my 16F84. I see the > 01010101 > STdF> pattern and then it stops, and the led i > connected at > STdF> that pin stays low. > > STdF> What CC5x does with > > STdF> led1 = pwm.0; > STdF> pwm = rr(pwm); > > STdF> is exactly what is in the main loop. > > STdF> As i said, when implemented on my PIC it does > not > STdF> work. > > STdF> grtz > > STdF> Simon > > > STdF> > __________________________________________________ > STdF> Do You Yahoo!? > STdF> Everything you'll ever need on one web page > STdF> from News and Sport to Email and Music Charts > STdF> http://uk.my.yahoo.com > > -- > http://www.piclist.com hint: The PICList is archived > three different > ways. See http://www.piclist.com/#archives for > details. > > __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body