![]() | ![]() | ![]() |
| | #31 |
|
Okay, if only to prove that I'm not a complete idiot, here's what I can make work quite easily. In fact, I've got an LED blinking steadily off pin 18 as I write this. Here's the GCBASIC code: Code: #chip 16F88, 8 #config OSC = INTRC_IO, MCLR_ON 'Set the pin directions dir PORTA.1 out 'check the PIC pins for these ports! 'Main routine Start: SET PORTA.1 ON wait 1 sec SET PORTA.1 OFF wait 1 sec goto Start Code: ;Program compiled by Great Cow BASIC (0.9 10/2/2007) ;Need help? See the GCBASIC forums at http://sourceforge.net/forum/?group_id=169286, ;check the documentation or email hconsidine@bigpond.com. ;******************************************************************************** ;Set up the assembler options (Chip type, clock source, other bits and pieces) LIST p=16F88, r=DEC #include <P16F88.inc> __CONFIG _CONFIG1, _INTRC_IO & _MCLR_ON & _WDT_OFF & _LVP_OFF ;******************************************************************************** ;Set aside memory locations for variables DELAYTEMP equ 32 DELAYTEMP2 equ 33 DELAYTEMP4 equ 34 SysTemp1 equ 35 SysTemp2 equ 36 SysWaitTempMS equ 37 SysWaitTempS equ 38 ;******************************************************************************** ;Jump to initialisation code when PIC is reset ORG 0 call INITSYS goto SystemInitialise ;******************************************************************************** ;Interrupt vector ORG 4 retfie ;******************************************************************************** ;Various initialisation routines, automatically called by GCBASIC SystemInitialise ;******************************************************************************** ;Start of the main program banksel TRISA bcf TRISA,1 START banksel PORTA bsf PORTA,1 movlw 1 movwf SysWaitTempS call Delay_S bcf PORTA,1 movlw 1 movwf SysWaitTempS call Delay_S goto START BASPROGRAMEND sleep goto $ ;******************************************************************************** ;Subroutines included in program ;******************************************************************************** DELAY_MS DMS_START movlw 10 movwf DELAYTEMP2 DMS_OUTER movlw 66 movwf DELAYTEMP DMS_INNER decfsz DELAYTEMP, F goto DMS_INNER decfsz DELAYTEMP2, F goto DMS_OUTER decfsz SysWaitTempMS, F goto DMS_START return ;******************************************************************************** Delay_S DS_START movlw 10 movwf DELAYTEMP4 DS_OUTER movlw 100 movwf SysWaitTempMS call Delay_MS decfsz DELAYTEMP4, F goto DS_OUTER decfsz SysWaitTempS, F goto DS_START return ;******************************************************************************** INITSYS movlw 112 movwf SysTemp1 banksel OSCCON movf OSCCON,W banksel SysTemp1 iorwf SysTemp1,W banksel OSCCON movwf OSCCON banksel PORTA clrf PORTA clrf PORTB movlw 7 banksel CMCON movwf CMCON banksel ADCON0 bcf ADCON0,ADON banksel ADCON1 bcf ADCON1,ADFM clrf ANSEL banksel STATUS return ;******************************************************************************** END Which brings me to the point where I must be screwing up the process when I'm not using GCBASIC. You guys say your program's work for you, so I must be doing something wrong in MPLAB, but I can't figure out what. Please help, this is driving me nutty! | |
| |
| | #32 | |
| Quote:
Last edited by Hank Fletcher; 9th June 2008 at 03:05 AM. | ||
| |
| | #33 |
|
Post your .hex file that doesn't work. PS try using your ICD2 as a debugger. You can see exactly what it's doing that way. Last edited by blueroomelectronics; 9th June 2008 at 03:07 AM. | |
| |
| | #34 | |
| Quote:
| ||
| |
| | #35 | |
| Quote:
Last edited by Hank Fletcher; 9th June 2008 at 03:18 AM. | ||
| |
| | #36 |
|
I tried to do a Quick Build (just experimenting with things) on the text I posted earlier of Bill's blinking program, and this is what happened: Code: Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F88 "billink.asm" /l"billink.lst" /e"billink.err" Warning[205] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 1 : Found directive in column 1. (list) Error[105] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 2 : Cannot open file (Include File "(p16f88.inc)" not found) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 3 : Symbol not previously defined (_CONFIG1) Error[126] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 3 : Argument out of range (not a valid config register address) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 5 : Symbol not previously defined (STATUS) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 5 : Symbol not previously defined (RP0) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 7 : Symbol not previously defined (OPTION_REG) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 9 : Symbol not previously defined (TRISA) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 10 : Symbol not previously defined (STATUS) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 10 : Symbol not previously defined (RP0) Error[113] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 12 : Symbol not previously defined (PORTA) Error[173] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 15 : Source file path exceeds 62 characters (C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM) Halting build on first failure as requested. BUILD FAILED: Sat Jun 07 23:23:10 2008 Code: list p=16f88 include (p16f88.inc) __CONFIG _CONFIG1, 0x2F34 org 0 bsf STATUS, RP0 movlw b'00001110' movwf OPTION_REG movlw b'00111111' movwf TRISA bcf STATUS, RP0 movlw b'10000000' xorwf PORTA, f sleep end Last edited by Hank Fletcher; 9th June 2008 at 03:28 AM. | |
| |
| | #37 | |
| Quote:
Code: Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F88 "billink.asm" /l"billink.lst" /e"billink.err" Message[302] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 7 : Register in operand not in bank 0. Ensure that bank bits are correct. Message[302] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 9 : Register in operand not in bank 0. Ensure that bank bits are correct. Error[173] C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM 15 : Source file path exceeds 62 characters (C:\PROGRAM FILES\GCBASIC\NOT GCBASIC FILES (ASSEMBLY CODED)\BILLINK.ASM) Halting build on first failure as requested. BUILD FAILED: Sat Jun 07 23:33:53 2008 | ||
| |
| | #38 |
|
Are you using the Wizard, if not then follow the posters instructions. I've attached your code as my MPLAB sees it. You need to copy all the files into a directory called C:\Internet PIC\ From MPLAB open workspace and locate C:\Internet PIC\HANK Then hit Build All, then Animate... | |
| |
| | #39 |
|
Booya! Just moving the billink.asm file to another location to fix Error[173] sorted the rest out. The LED's blinking, and it only took me the better part of a day! I wonder why I was having so much trouble making a .hex, but the Quickbuild function worked just fine? If there are two things I'd like to get out of this, it's: 1) How to get it to work without using Quickbuild; 2) The nitty-gritty of what's going on in Bill's program. Thanks all! Last edited by Hank Fletcher; 9th June 2008 at 03:44 AM. | |
| |
| | #40 |
|
It sounds like you've got the wrong toolsuite setup, the wizard helps sort that out when you use it.
| |
| |
| | #41 | |
| Quote:
| ||
| |
| | #42 |
|
No, wait, I was wrong about any superfluous "config." It's in the program I'm running now, and it's doing fine. ?! I must have missed something. I see the list is where it ought to be with respect to the rest of the code in Bill's poster, I must have copied it wrong somewhere, or I just didn't appreciate the significance of indenting the entire program. | |
| |
| | #43 |
| Code: list p=16F88 include <p16F88.inc> __CONFIG _CONFIG1, 0x2F34 | |
| |
| | #44 |
|
Is the 16f88 running at 8MHz in Bill's program? How can I know that?
| |
| |
| | #45 | |
| Quote:
| ||
| |
|
| Tags |
| mplab, problem, programming or compiling |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Programming C in MPLAB | simrantogether | Micro Controllers | 11 | 11th February 2008 07:40 PM |
| Programming PICC through MPLAB | MatrixPhreak | Micro Controllers | 25 | 9th December 2007 04:56 PM |
| Programming HEX file with MPlab/Inchworm | gregmcc | Micro Controllers | 4 | 27th April 2007 04:20 PM |
| compiling with MPLAB | evandude | Micro Controllers | 4 | 9th April 2005 09:08 AM |
| Compiling 16F628A - problem | kenmac | Micro Controllers | 4 | 23rd September 2004 06:00 AM |