'No Branch command?'
David E. Queen
I downloaded the PDF format version of the 16c6X and 16c7X chips and
looked under the INSTRUCTION SET SUMMARY and could not find a conditional
How do you write code without a compare or conditional branch?
Also could someone point me to some 16c64 or 16c65 code using to
read and write to an I2C serial eeprom? I need to read/write 440x 6 bytes
, another 100x 6 bytes, and a single byte data elements to this chip.
Its dumb but for my first project I picked a big one.
Its something we could use at work to get rid of 15 early 70's vintage
descret transistor differential amps, all on individual plug in pc boards,
and a matched set of about 30 oven stabilized log current diodes.
Ever try to keep 20 year old RC timing circuits stable? Some of the wiring is
starting to develop 100k ohm range phantom connections....
All I need to have it do is generate 3 stable exposure times. I plan to
pre-calculate all the 440 possible times and store them in the eeprom.
I also plan to store 100 setups. Its the user interface that makes it
a big project. LCD display, 5 encoders (NO MORE POTS YEAH!), a couple
push buttons and hooking up to 24v relays to connect the thing.
I have taken up too much bandwidth already. Thanks for any help.
There are several versions of the jump command that do a conditional jump
based on the status of several flags.
I'm sure you'll hear more about this from others.
At 12:43 13-05-1996 -0500, you wrote:
>I downloaded the PDF format version of the 16c6X and 16c7X chips and
>looked under the INSTRUCTION SET SUMMARY and could not find a conditional
>How do you write code without a compare or conditional branch?
Hello all (and specially Roger)
Take a close look at the following instructions:
BTFSC file_register,bit_number ;test bit, skip if clear
BTFSS file_register,bit_number ;test bit, skip if set
DECFSZ file_register,destination ;decrement file register, skip if zero
GOTO _label ;absolute jump
INCFSZ file_register,destination ;increment file register, skip if zero
All these instructions (except GOTO) skip the next one if the condition is
satisfied. Other jumps can be made by direct manipulation of PCL and/or PCLATH.
Since the status flags are also a file register, the conditional jumps can
using the instructions above. Some examples:
MOVF AFileReg,F ;setup condition
flags (AFileReg unchanged)
BTFSS STATUS,Z ;test zero flag,
skip if set
GOTO _AFileReg_IsNotZero ;not set, AFileReg<>0
;code to execute if AFileReg=0
;code to execute if AFileReg<>0
MOVLW AValue ;load W with some value
ADDWF AFileReg,F ;add W with AFileReg
BTFSC STATUS,C ;test carry, skip if
GOTO _Overflow ;carry is set, go
;code to execute if AFileReg+AValue<=255
;code to execute if AFileReg+AValue>255
Comparing is done with the SUB instructions and then testing the Z and C flags.
Note that the examples above are true for the 16CXX PICs. I don't know much
the other ranges (16C5X and 17CXX)
Hope this helps (a bit).
On Mon, 13 May 1996, Roger Books wrote:
> There are several versions of the jump command that do a conditional jump
> based on the status of several flags.
Maybe he's talking about the Parallax pseudo-8051 assembler. <blech>
Actually, in PIC-native code there are no CONDITIONAL branch
commands. There are however several conditional "SKIP" commands.
The idea is that you'd usually follow the conditional skip with a
"goto" command, which would be skipped if the condition isn't met.
You get the same effect but you have to think a little differently
if you want to optimize the code.
Sorry, please ignore anything I say (including this if you want to.)
I'm trying to use 80x86 stuff on PIC's, well, that's even, I've tried to
use PIC assembly on 68K.
(As I shoot myself in the foot, yet again. :(
More... (looser matching)
- Last day of these posts
- In 1996
, 1997 only
- New search...