Thanks a lot Tim. I only plan on using one other bit on that chip for enabling purposes from the master .... but it is very useful to know that. I may try it to see what effect it has on the timing. Thanks again ----- Original Message ----- From: "Timothy Box" To: Sent: Wednesday, June 04, 2003 4:12 AM Subject: Re: Sinewave generation .... Thanks > John > > Just to warn you! You have used all of PortB unless the other bits are > inputs and you have set up the TRISB port up. If you want to use the other > half for outputs you will have to mask them off > > This code just alters the lower half of the port > > loop: > temp = portb & $F0 ' clear low bits > portb = temp | 1 ' add in the new lower bits and write back > temp = portb & $F0 > portb = temp | 2 > temp = portb & $F0 > portb = temp | 3 > .... > temp = portb & $F0 > portb = temp | 14 > temp = portb & $F0 > portb = temp | 15 > ptemp = portb & $F0 > portb = temp | 14 > .... > temp = portb & $F0 > portb = temp | 2 > temp = portb & $F0 > portb = temp | 1 > goto loop > > Tim > > > -----Original Message----- > From: pic microcontroller discussion list > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of moonshadow > Sent: 04 June 2003 19:41 > To: PICLIST@MITVMA.MIT.EDU > Subject: Sinewave generation .... Thanks > > > Thanks to all those who made suggestions. In the end I unrolled the loop and > used straight ... > > PORTB = 8 > PORTB = 9 etc etc > Goto beginning > > and the frequency shot up by almost a factor of ten !. So I have included a > delay of 1 uS at each point and fine tuned the frequency by adjusting the > number of points in each cycle. I am well pleased with the results for the > price of half a 628 port and five resistors. Thanks again chaps ...... John > Kent > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body