Re: [CAD_CAM_EDM_DRO] PIC programming
Posted by
james owens
on 2000-03-17 09:01:28 UTC
I should not be treated as a world authority on PIC's as I have just discovered them in the last few weeks and so far only the 16F877, but here goes.
The programming languge is very simple consisting of only about 37 instructions :-
ADDLW ADD Literal to W
ADDWF ADD W to f
ANDLW AND Literal and W
ANDWF AND W with f
BCF Bit Clear f
BSF Bit Set f
BTFSC Bit Test. Skip if Clear
BTFSS Bit Test. Skip if Set
CALL Subroutine Call
CLRF Clear f
CLRW Clear W register
CLRWDT Clear Watchdog Timer
COMF Complement f
DECF Decrement f
DECFSZ Decrement f. Skip if 0
GOTO Unconditional branch
INCF Increment f
INCFSZ Increment f. Skip if 0
IORLW Inclusive OR Literal with W
IORWF Inclusive OR W with f
MOVF Move f
MOVLW Move Literal to W
MOVWF Move W to f
NOP No Operation
OPTION# Load Option Register
RETFIE Return from Interupt
RETLW Return with Literal in W
RETURN Return from Subroutine
RLF Rotate Left through Carry
RRF Rotate Right through Carry
SLEEP Power-down
SUBLW Subtract W from Literal
SUBWF Subtract W from f
SWAPF Swap f
TRIS# Load TRIS Register
XORLW Exclusive OR Literal with W
XORWF Exclusive OR W with f
There may be more but I haven't used them yet in the TUTOR.
An example of a short program to turn on 8 Led's connected to port B.
CLRF 6 :set all port B pins to logic 0
BSF 3,5 :instruct program that a page 1 command comes next
CLRF 6 :set all port B pins as outputs
BCF 3,5 :instruct program that a page 0 command comes next
BSF 6,0 :set port B pin 0 to logic 1
BSF 6,1 :set port B pin 1 to logic 1
BSF 6,2 :set port B pin 2 to logic 1
BSF 6,3 :set port B pin 3 to logic 1
BSF 6,4 :set port B pin 4 to logic 1
BSF 6,5 :set port B pin 5 to logic 1
BSF 6,6 :set port B pin 6 to logic 1
BSF 6,7 :set port B pin 7 to logic 1
.END :final statement
Regards,
Terry
The programming languge is very simple consisting of only about 37 instructions :-
ADDLW ADD Literal to W
ADDWF ADD W to f
ANDLW AND Literal and W
ANDWF AND W with f
BCF Bit Clear f
BSF Bit Set f
BTFSC Bit Test. Skip if Clear
BTFSS Bit Test. Skip if Set
CALL Subroutine Call
CLRF Clear f
CLRW Clear W register
CLRWDT Clear Watchdog Timer
COMF Complement f
DECF Decrement f
DECFSZ Decrement f. Skip if 0
GOTO Unconditional branch
INCF Increment f
INCFSZ Increment f. Skip if 0
IORLW Inclusive OR Literal with W
IORWF Inclusive OR W with f
MOVF Move f
MOVLW Move Literal to W
MOVWF Move W to f
NOP No Operation
OPTION# Load Option Register
RETFIE Return from Interupt
RETLW Return with Literal in W
RETURN Return from Subroutine
RLF Rotate Left through Carry
RRF Rotate Right through Carry
SLEEP Power-down
SUBLW Subtract W from Literal
SUBWF Subtract W from f
SWAPF Swap f
TRIS# Load TRIS Register
XORLW Exclusive OR Literal with W
XORWF Exclusive OR W with f
There may be more but I haven't used them yet in the TUTOR.
An example of a short program to turn on 8 Led's connected to port B.
CLRF 6 :set all port B pins to logic 0
BSF 3,5 :instruct program that a page 1 command comes next
CLRF 6 :set all port B pins as outputs
BCF 3,5 :instruct program that a page 0 command comes next
BSF 6,0 :set port B pin 0 to logic 1
BSF 6,1 :set port B pin 1 to logic 1
BSF 6,2 :set port B pin 2 to logic 1
BSF 6,3 :set port B pin 3 to logic 1
BSF 6,4 :set port B pin 4 to logic 1
BSF 6,5 :set port B pin 5 to logic 1
BSF 6,6 :set port B pin 6 to logic 1
BSF 6,7 :set port B pin 7 to logic 1
.END :final statement
Regards,
Terry
----- Original Message -----
From: Murray Leshner
To: CAD_CAM_EDM_DRO@onelist.com
Sent: Friday, March 17, 2000 5:43 AM
Subject: [CAD_CAM_EDM_DRO] PIC programming
From: "Murray Leshner" <multi-volti@...>
I haven't looked at PIC uC's in years. Do they still use their own semi-high
level language, something higher than uP assembly language, but not quite
Basic?
I also just saw a new CPU development system called Rabbit 2000 (doesn't
give me alot of confidence...I can just see it gnawing things) and it comes
with C compiler. I'm reluctant to learn C to write some code.
Thanks
Murray
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Welcome to CAD_CAM_EDM_DRO@...,an unmoderated list for the discussion of shop built systems in the above catagories.
To Unsubscribe, read archives, change to or from digest.
Go to: http://www.onelist.com/isregistered.cgi
Log on, and you will go to Member Center, and you can make changes there.
For the FAQ, go to http://www.ktmarketing.com/faq.html
bill,
List Manager
[Non-text portions of this message have been removed]