Searching \ for 'instructions' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=instructions
Search entire site for: 'instructions'.

Truncated match.
PICList Thread
'instructions'
2000\06\15@232037 by Tony Nixon

flavicon
picon face
Just mucking around with code and the PIC does not seem to like this
combination. Weird things start happening.

       incf FSR
       bcf FSR,7
       bsf FSR,6

I'm trying to keep the FSR value between 0x40 and 0xFF


--
Best regards

Tony

http://www.picnpoke.com
spam_OUTsalesTakeThisOuTspampicnpoke.com

2000\06\16@004604 by Nikolai Golovchenko

flavicon
face
Tony,
If you need to cycle FSR from 0x40 to 0xFF and again, may be this will
work:
       incf FSR, f     ;increment FSR
       skpnz           ;check for overflow from 255 to 0
       bsf FSR, 6      ;if overflow fix FSR to 0x40

FSR should be preloaded with a number in 0x40-0xFF range.

Nikolai

On Friday, June 16, 2000 Tony Nixon wrote:
{Quote hidden}

2000\06\16@011019 by Tony Nixon

flavicon
picon face
Nikolai Golovchenko wrote:
>
> Tony,
> If you need to cycle FSR from 0x40 to 0xFF and again, may be this will
> work:
>         incf FSR, f     ;increment FSR
>         skpnz           ;check for overflow from 255 to 0
>         bsf FSR, 6      ;if overflow fix FSR to 0x40
>
> FSR should be preloaded with a number in 0x40-0xFF range.

Thanks for the tip.

I was trying to do it with the least instruction count and be
'isosynchronous'.

I learnt that here ;-)


What I am trying to do is output an 8 bit value to PortB as quick as
possible. The data is coming from RAM at address 0x40 to 0x7F. To avoid
the problems I had with quick succession BSF BCF instructions I had to
do the following...

WaveData7  bsf FSR,6
          movf INDF,W
          incf FSR
          movwf PORTB
          bcf FSR,7
          goto WaveData7

I guess the internal bus can't keep up with multiple read/write/modify
instructions on the same register.

This is a short as I can get it which results in a repetition rate of
about 2.2KHz at 4MHz. I just got the ROMzap software to do sine,
rectified, triangle and arbitrary waves from PORTB. They look quite good
on the CRO with a simple R2R, but filtering is obviously needed. The
arbitrary waves are good. Just draw them on the PC screen and out of
PORTB they come.

I was hoping to have this done sooner, but some friends arrived here to
do some choir singing with the Melbourne Philharmonic Orchestra so we
took time off to show them around. Strange thing was, they live in
Chandler Arizona right near the Microchip HQ, but they didn't have a
clue what a PIC was.

--
Best regards

Tony

http://www.picnpoke.com
salesspamKILLspampicnpoke.com

2000\06\16@025642 by Michael Rigby-Jones

flavicon
face
> -----Original Message-----
> From: Tony Nixon [SMTP:.....Tony.NixonKILLspamspam.....ENG.MONASH.EDU.AU]
> Sent: Friday, June 16, 2000 6:08 AM
> To:   EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU
> Subject:      Re: instructions
>
> What I am trying to do is output an 8 bit value to PortB as quick as
> possible. The data is coming from RAM at address 0x40 to 0x7F. To avoid
> the problems I had with quick succession BSF BCF instructions I had to
> do the following...
>
That is a bit of a concern to me.  I have never had problems using multiple
bit operations on an internal register, nor would I expect it, certainly not
running at 4MHz.  Port pins are a special case as they are exposed to all
the capacitive/inductive bits and pieces that you hang of them.  I might
expect this sort of thing if the PIC was grossly overclocked.  Did you try
more than one PIC/is this repeatable?

Regards

Mike Rigby-Jones

2000\06\16@074438 by Bob Ammerman
picon face
----- Original Message -----
From: Tony Nixon <Tony.Nixonspamspam_OUTENG.MONASH.EDU.AU>
To: <@spam@PICLISTKILLspamspamMITVMA.MIT.EDU>
Sent: Thursday, June 15, 2000 11:18 PM
Subject: instructions


> Just mucking around with code and the PIC does not seem to like this
> combination. Weird things start happening.
>
>         incf FSR
>         bcf FSR,7
>         bsf FSR,6
>
> I'm trying to keep the FSR value between 0x40 and 0xFF

But your code will force FSR into the range 0x40 thru 0x7F!

>
>
> --
> Best regards
>
> Tony
>
> http://www.picnpoke.com
> KILLspamsalesKILLspamspampicnpoke.com

2000\06\16@082153 by Scott Dattalo

face
flavicon
face
On Fri, 16 Jun 2000, Tony Nixon wrote:

{Quote hidden}

Tony,

If you're trying to squirt out a wave form as fast as possible and your table is
only 0x40 (64) bytes then you could unroll the loop:

begin:
   movf  0x40,w
   movwf portb

   btfsc porta,should_quit_bit
    goto through


   movf  0x41,w
   movwf portb

   btfsc porta,should_quit_bit
    goto through

   ...

   movf  0x7f,w
   movwf portb

   goto  begin


4-isochronous cyles per sample with the ability to break out of the loop.

If you don't want the break to be under software control, then this can be
reduced to 3 cycles.

The only problem with this approach for an 'arbitrary waveform generator' is
that the output frequency is fixed. I've done this kind of thing before and
varied the output frequency by vary the frequency of the clock signal fed to the
pic. In my case, I just took a function generator and hooked to the xtal pins,
pumped in a variable frequency, 0-5 V square wave.

If you don't have a function generator at your disposal, then the next best
thing is a phase accumulator. Essentially what you do is store one full cycle's
worth of data somewhere - either in ram or rom - and step through it at a
constant rate, but vary the step size according to the frequency. This is the
approach my sine wave generator uses. In my case the sine wave (or 1/4 'th of
it) is stored in a table.

The phase accumulator could be used in your case too. About 10 cycles per sample
would be needed...


{Quote hidden}

2000\06\16@083141 by Nikolai Golovchenko

flavicon
face
How about storing the waveform in Flash. For example,
Start
       movlw 0
       movwf PORTB
       goto $+1
       movlw 1
       movwf PORTB
       goto $+1
       ...
       movlw 63
       movwf PORTB
       goto Start

3 x 64 = 192 instructions

4 x 64 = 256 instruction cycles => 3.9 kHz max repetition rate at
4 MHz clock


Nikolai

On Friday, June 16, 2000 Tony Nixon wrote:
> What I am trying to do is output an 8 bit value to PortB as quick as
> possible. The data is coming from RAM at address 0x40 to 0x7F. To avoid
> the problems I had with quick succession BSF BCF instructions I had to
> do the following...

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...