![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I am using Inchworm to program My targeted Microcontroller, my targeted microcontroller is also PIC16F877A.
I write this program in Assembly Code:
;**********Declaration & Microcontroller configuration************** Processor 16F877A #include "P16F877A.INC" __config 0x3F3A ;*******************Declaration of Variable************************* cblock 0x20 CounterA CounterB CounterC endc ;******************Program memory structure************************* org 0x0000 goto main ;************************Main Program******************************** main movlw b'00000000' movwf TRISC Program movlw b'00000000' movwf PORTC call Delay movlw b'11111111' movwf PORTC call Delay goto Program ;Endless loop Delay ;PIC Time Delay = 0.3130012 s with Osc = 20.000000 MHz movlw D'8' movwf CounterC movlw D'248' movwf CounterB movlw D'106' movwf CounterA loop decfsz CounterA,1 goto loop decfsz CounterB,1 goto loop decfsz CounterC,1 goto loop return END Code:
Clean: Deleting intermediary and output files. Clean: Deleted file "LED.err". Clean: Deleted file "E:\Projects\LedTest\LED.cod". Clean: Deleted file "E:\Projects\LedTest\LED.hex". Clean: Deleted file "LED.lst". Clean: Done. Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F877A "LED.asm" /l"LED.lst" /e"LED.err" Message[302] E:\PROJECTS\LEDTEST\LED.ASM 21 : Register in operand not in bank 0. Ensure that bank bits are correct. Loaded E:\Projects\LedTest\LED.COD. BUILD SUCCEEDED: Wed Mar 07 22:58:48 2007 Code:
MPLAB ICD 2 Ready Erasing Target Device... ...Erase Succeeded MPLAB ICD 2 Ready Blank Checking... ...Program Memory .. Config Memory ...EEPROM ...User ID Memory ...Blank Check Passed MPLAB ICD 2 Ready Programming Target... ...Validating configuration fields ...Erasing Part ...Programming Program Memory (0x0 - 0xB7) Verifying... ...Program Memory ...Verify Succeeded Programming Configuration Bits .. Config Memory Verifying configuration memory... ...Verify Succeeded ...Programming succeeded 07-Mar-2007, 22:51:58 MPLAB ICD 2 Ready Where is the mistake??? |
|
|
|
|
|
|
(permalink) |
|
wish mine was working
did you release it from reset? what does your target circuit look like? Last edited by williB; 7th March 2007 at 05:43 PM. |
|
|
|
|
|
|
(permalink) |
|
I would check the configuration word.
|
|
|
|
|
|
|
(permalink) |
|
To run a PIC
you need to power the chip apply 5V to mclr to keep it out of reset it must oscillate (with a clock chip or a crystal) and the LED circuit must be hooked up correctly. if all this is correct , maybe it is blinking too fast to see |
|
|
|
|
|
|
(permalink) |
|
I am using Firefly Z.........ZIF only to program PIC16F877A.
|
|
|
|
|
|
|
(permalink) |
|
What williB said.
Then use the Inchworm as an debugger(not programmer) to program, then try to step through you code. If you do not know what I am talking about check out the Microchip doc on MPLAB and debugging Esp chapter 5 on ICD. http://ww1.microchip.com/downloads/en/devicedoc/51331B.pdf |
|
|
|
|
|
|
(permalink) |
|
spouse i have a hex file compiled from another compiler(Mikrobasic) & want to feed this hex file into my targeted controller(PIC16F877A)..... how can i do this using inchworm???????????????????
|
|
|
|
|
|
|
(permalink) |
|
Thanks to the Lord Allah........
Problem solved... There is a little mistake in program, i didn't select proper Banks for Registers. Below is the correct program, Code:
;**********Declaration & Microcontroller configuration************** Processor 16F877A #include "P16F877A.INC" __config 0x3F3A ;*******************Declaration of Variable************************* cblock 0x20 CounterA CounterB CounterC endc ;******************Program memory structure************************* org 0x0000 goto main ;************************Main Program******************************** main banksel TRISD movlw b'00000000' movwf TRISD Program banksel PORTD movlw b'10101010' movwf PORTD call Delay movlw b'01010101' movwf PORTD call Delay goto Program ;Endless loop Delay ;PIC Time Delay = 0.3130012 s with Osc = 20.000000 MHz movlw D'8' movwf CounterC movlw D'248' movwf CounterB movlw D'106' movwf CounterA loop decfsz CounterA,1 goto loop decfsz CounterB,1 goto loop decfsz CounterC,1 goto loop return END |
|
|
|
|
|
|
(permalink) | |
|
Quote:
File / Import "filename.hex" That's it, PICBASIC Pro can be integrated into MPLAB |
||
|
|
|
|
|
(permalink) | |
|
I have a HEX file named LEDS.HEX in my computer want to feed this file into PIC16F877A using inchworm.
1. I open MPLAB 2. I press File>Import, then i select my desired HEX file 3. OUTPUT windows is showing in Build tab Quote:
|
||
|
|
|
|
|
(permalink) |
|
Ayne ,
if you just want to see it 'in memory ' click on the View tab , then click 'program memory' |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| DSpic compiler and programmer | jrz126 | Micro Controllers | 31 | 20th April 2008 10:03 PM |
| PIC Programmer using C | burg | General Electronics Chat | 2 | 24th January 2007 07:26 AM |
| Getting started with PIC programming and building the Inchworm | Hedos | Micro Controllers | 3 | 30th November 2006 02:44 AM |
| Using C or Assembly? | rkim01 | Micro Controllers | 2 | 5th July 2006 02:06 PM |
| Newcomers, please read! (PIC regarded) Upd. 0xD | Jay.slovak | Micro Controllers | 0 | 17th April 2005 01:04 PM |