This is a multi-part message in MIME format. ------=_NextPart_000_00CF_01C465A1.15A93FD0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Resen with attachment. This is for the 16f87x but it might help understanding how to set up asm files ----- Original Message ----- From: "redtock8" To: Sent: Friday, July 09, 2004 10:35 AM Subject: Re: [PIC:] First swing at asm > This is for the 16f87x but it might help understanding > how to set up asm files > > > ----- Original Message ----- > From: "Robert B." > To: > Sent: Thursday, July 08, 2004 10:15 PM > Subject: Re: [PIC:] First swing at asm > > > > Thanks for the comments. I am particularly glad to know that a c-like > > preprocessor exists. I figured there were include files with pre-defined > > constants for the chips, but hadn't looked it up yet. Thanks for the > heads > > up with all these tricks and tips! > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu ------=_NextPart_000_00CF_01C465A1.15A93FD0 Content-Type: text/plain; name="Setting up a 16F87x.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Setting up a 16F87x.txt" Setting up a 16F87x=20 Setting up a 16F87x=20 Tony Nixon [sales at picnpoke.com] of ICmicro's says:=20 Title "Your Program" ; list P =3D 16F877 ; include "P16f877.inc" ; ; ------------------ ; CONFIGURATION FUSE ; ------------------ ; __CONFIG _CP_OFF & _WRT_ENABLE_ON & _RC_OSC & _WDT_ON & = _PWRTE_OFF & _BODEN_ON & _LVP_ON & _CPD_OFF & _DEBUG_OFF ; ; CRYSTAL SPEED =3D 4000000Hz ; CBLOCK 0x20 dataL ENDC ; ; ------------- ; PROGRAM START ; ------------- ; org 0x0000 ; startup =3D 0000h ; Start movlw 0x00 ; setup ports movwf PORTA movlw 0x00 movwf PORTB movlw 0x40 movwf PORTC movlw 0x00 movwf PORTD movlw 0x00 movwf PORTE bsf STATUS,RP0 ; RAM Page 1 movlw 0x00 movwf TRISA movlw 0x00 movwf TRISB movlw 0x80 movwf TRISC movlw 0xFF movwf TRISD movlw 0xFF movwf TRISE ; ; ------------------------- ; SET ANALOG/DIGITAL INPUTS ; ------------------------- ; movlw 0x06 ; all digital movwf ADCON1 ; ; ------------------------------------ ; SET BAUD RATE TO COMMUNICATE WITH PC ; ------------------------------------ ; Boot Baud Rate =3D 19200, No Parity, 1 Stop Bit ; movlw 0x0C ; 19200 baud movwf SPBRG movlw b'00100100' ; brgh =3D high (2) movwf TXSTA ; enable Async Transmission, set brgh movlw b'10010000' ; enable Async Reception bcf STATUS,RP0 ; RAM Page 0 movwf RCSTA ; ; ------------------------------------ ; PROVIDE A SETTLING TIME FOR START UP ; ------------------------------------ ; clrf dataL settle decfsz dataL,F goto settle ; movf RCREG,W movf RCREG,W movf RCREG,W ; flush receive buffer Loop call Receive ; wait for a char movwf TXREG ; echo data back to sender goto Loop ; ; ---------------------------- ; RECEIVE CHARACTER FROM RS232 ; ---------------------------- ; This routine does not return until a character is received. ; Receive btfss PIR1,RCIF ; (5) check for received data goto Receive ; movf RCREG,W return ; ; ------------------------------------ ; WAIT UNTIL RS232 IS FINISHED SENDING ; ------------------------------------ ; TransWt bsf STATUS,RP0 WtHere btfss TXSTA,TRMT ; (1) transmission is complete = if hi goto WtHere ; clrf STATUS ; RAM Page 0 return ; ; end See:=20 Questions:=20 file: techref/microchip/16f877/setup.htm, updated: 5/14/03 2:26:08 PM, = TOP NEW=20 MORE.. SEARCH:=20 68.114.32.144:LOG IN PLEASE DON'T RIP!These pages are served without=20 commercial sponsorship. (No popup ads, etc...). Bandwidth abuse will = increase=20 hosting cost and force sponsorship or shutdown. This server aggressively = defends=20 against automated copying for any reason including offline viewing, = duplication,=20 etc... Please respect this requirement and DO NOT RIP THIS SITE. = Questions?=20 Did you find what you needed?=20 "Not quite. Look for more pages like this one."=20 "No. I'm looking for: "=20 "No. Take me to the search page."=20 "No. Take me to the top so I can drill down by catagory"=20 "No. I'm willing to pay for help, please refer me to a qualified = consultant"=20 "No. But I'm interested. me at when this page is expanded." After you find an appropriate page, you are invited to your = question=20 comment link program listing to this massmind site! (posts will be = reviewed)=20 Just type in the box and press the Post button. (HTML welcomed!): A = tutorial is=20 available Members can LOGIN to post directly, become page editors, and = be=20 credited for their posts.=20 =20 Link? Put it here: =20 if you want a response, please enter your email address: =20 Check out Doug Woods' EXCELLENT=20 PIC Microcontroller Instruction Set Quick Reference and Core Comparison = Matrix=20 Feel the NEED for SPEED?=20 Ubicom SX18 thru SX52, PIC 16c5X compatibile, 50 to 75 MIPS = microcontrollers!=20 Now US customers can buy the Excellent SXDev from SXList.com=20 for $150 + $15 import fee + s&h (~ $180 total+tax in CA) -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu ------=_NextPart_000_00CF_01C465A1.15A93FD0--