Thanks for the help everyone. The stupid mistakes you make when you're tired!!!! Stew > -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of PicDude > Sent: 22 June 2006 04:38 > To: Microcontroller discussion list - Public. > Subject: Re: [PIC] Overwriting Previous Address Contents > > "org 0" says to start placing those instructions at code address 0, and > subsequent instructions at addresses 1, 2, 3, 4, 5, etc. Later, you use > "org > 4", telling the assembler to start placing those instructions in location > 4, > which is already occupied. So it's telling you that it's overwriting the > previous address contents. > > After "org 0", you should tell it to "goto" some other location or "call > some > other routine" where you have more space for code. > > Take a look at the ".LST" file that the assembler creates, as it will show > you > where each instruction is placed in the address space. > > Cheers, > -Neil. > > > On Wednesday 21 June 2006 08:13, Stewart Abel wrote: > > I have written the following code for a PIC16f73: > > > > INCLUDE "p16f73.inc" > > > > CBLOCK 0x020 > > _w, _status, ins, pins, inres > > ENDC > > > > PAGE > > > > org 0 > > > > nop > > clrf PORTB > > > > bsf STATUS, RP0 > > movlw 0x070 > > movwf TRISB > > bcf STATUS, RP0 > > > > movlw 0x088 > > movwf INTCON > > movlw 0x00C > > movwf PORTB > > > > movfw PORTB > > movwf pins > > > > goto mainline > > > > > > org 4 > > > > Int > > movwf _w ; Save Status register prior to > > Interrupt Handler > > movf STATUS, w > > movwf _status > > movfw PORTB > > movwf ins > > > > bcf INTCON, RBIF > > > > xorwf pins, w > > movwf inres > > btfsc inres, 4 > > goto Forward > > btfsc inres, 5 > > goto Reverse > > > > goto Stop > > > > Forward > > movlw 0x00A > > movwf PORTB > > goto IntEnd > > > > Reverse > > movlw 0x005 > > movwf PORTB > > goto IntEnd > > > > Stop > > movlw 0x003 > > movwf PORTB > > > > IntEnd > > movfw ins > > movwf pins > > movf _status, w ; Restore Status Register > > movwf STATUS > > swapf _w, f > > swapf _w, w > > > > retfie > > > > mainline > > goto $ > > > > end > > > > > > When I try to build it I get the following errors > > > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 33 : Overwriting previous > > address contents (0004) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 33 : Overwriting previous > > address contents (0004) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 34 : Overwriting previous > > address contents (0005) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 34 : Overwriting previous > > address contents (0005) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 35 : Overwriting previous > > address contents (0006) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 35 : Overwriting previous > > address contents (0006) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 36 : Overwriting previous > > address contents (0007) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 36 : Overwriting previous > > address contents (0007) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 37 : Overwriting previous > > address contents (0008) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 37 : Overwriting previous > > address contents (0008) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 39 : Overwriting previous > > address contents (0009) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 39 : Overwriting previous > > address contents (0009) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 41 : Overwriting previous > > address contents (000A) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 41 : Overwriting previous > > address contents (000A) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 42 : Overwriting previous > > address contents (000B) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 42 : Overwriting previous > > address contents (000B) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 43 : Overwriting previous > > address contents (000C) > > Error[118] C:\PIC PROJECTS\MOTOR\MOTOR.ASM 43 : Overwriting previous > > address contents (000C) > > > > I cant work out what is wrong. An anyone shed any light. > > > > Cheers > > stew > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist