![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Please consider the following code: Code:
INCLUDE "P16F627A.INC"
LIST P=16F627A
__Config _INTOSC_OSC_NOCLKOUT & _DATA_CP_OFF & _CP_OFF &_LVP_OFF &_BOREN_ON & _MCLRE_OFF & _WDT_OFF & _PWRTE_OFF
cblock 0x20
SDelayCount
endc
org 0
poweron
BSF STATUS,RP0 ;MOVE TO BANK1
CLRF TRISB ;PORT B ALL OUTPUTS
CLRF TRISA ;PORT a ALL OUTPUTS, EXCLUDING A5 OBVIOUSLY
BCF STATUS, RP0 ;MOVE TO BANK0
CLRF PORTA
MOVLW 0x07 ;Turn comparators off and
MOVWF CMCON ;enable pins for I/O
again
MOVLW 0xff
movwf PORTA
MOVLW 0
MOVWF PORTB
call ShortDelay
MOVLW 0x00
movwf PORTA
MOVLW 0
MOVWF PORTB
call ShortDelay
goto again
ShortDelay
MOVLW H'40' ;Get current selected multiplex rate
MOVWF SDelayCount ;Store desired delay count
SDelayLoop
NOP
NOP
NOP
NOP
DECFSZ SDelayCount
GOTO SDelayLoop
retlw 0
END
For some reason when the ShortDelay is called the PCL is set to the correct position(i.e MOVLW instruction), but the next time i press step into, the executing line skips to SDelayLoop. if i press step into again, PCL Jumps away from my code to an undefined bit of memory (PCL reads Decimal:119). My shortDelay code is never executed, and the microcontroller is no longer running any of my code! Does anyone know whats happening here? Many thanks ![]() | |
| |
| | #2 | |
| Quote:
So no, I don't know what's wrong with your simulation. | ||
| |
| | #3 |
|
Ah, so something wrong with mplab. thanks mate, perhaps time to try and reinstall. | |
| |
| | #4 |
|
Be sure to step into and not over.
| |
| |
| | #5 |
|
The only time I have seen this happen is when I have stepped through code that has been changed but not been recompiled. Mike. | |
| |
| | #6 |
|
I believe that its somthing to do with an incompatability between mplab and vs.net 2005! I shall email microchip. | |
| |
| | #7 | |
| Quote:
| ||
| |
| | #8 |
|
I do alot of programming in C#, so im obviously running MPLAB and VS.net 2005 on the same machine (sometimes at the same time). Im experiencing wierd problems trying to build tried and tested code in MPLAB. If i re-install MPLAB, all the problems vanish until the next time I run VS.net. Then I get build errors the next time I try and assemble code in MPlab. I have just found a website that says " If you are running Visual Studio, then you may or may not know that Visual Studio appears to co-opt the file extension .cod. Apparently, Visual Studio doesn't play well with others, as it won't let other programs that need or use files having that extension...like MPLAB...use it for their own purposes. * To the best of my observation, computers running Visual Studio will give linker errors when you attempt to build assembly files in MPLAB. The visible symptoms of the problem are error messages that refer to stack underflow or core errors. I will try to get specific error messages, so that you know what you're looking for to see if it's happened. * The quickest solution (the one that was applied to best effect in the CEL) is to do a clean reinstall of MPLAB. This will make MPLAB work again, at least up to the point where you use Visual Studio to do something. Since no one uses Visual Studio in the CEL, we haven't had the chance to observe whether it attempts to grab the extension again. * If you use Visual Studio often, you may find the MPLAB problem to be a recurring one. " | |
| |
| | #9 | |
| Quote:
| ||
| |
| | #10 |
|
Does setting the "Suppress Cod-file generation" in "Project>Build Options>project>MPLINK Linker" help. Mike. | |
| |
| | #11 | |
| Quote:
It turns out that in the latest version, this flag is allready set by default. Its so annoying! Stupid Micro$oft ![]() ![]() ![]() Cant say that Microchip are being much help either. Im going to try running two WINXP users at the same time and using the user switching functionallity of XP. One user will run VS.NET, the other MPLAB. If it works, the only problem i will then have, is making sure I dont run VS.NET on the MPLAB user account ![]() Cheers. | ||
| |
| | #12 |
|
It would appear that my workaround works. Its definately easier than re-installing every 5 minutes.
| |
| |
|
| Tags |
| asm, calls, mplab, properly |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Debugging 877A with MPLAB | williB | Micro Controllers | 10 | 7th May 2007 04:53 PM |
| Inchworm components | gregmcc | Micro Controllers | 43 | 18th March 2007 02:37 PM |
| Need help badly on Inchworm and MPLAB | thushy | Micro Controllers | 14 | 11th March 2007 07:05 PM |
| Some Question About Inchworm | Ayne | Micro Controllers | 29 | 7th March 2007 04:08 AM |
| Inchworm project started | williB | Micro Controllers | 69 | 5th March 2007 07:56 PM |