PDA

View Full Version : Initializing Osc, Wdt and Power up



crhomberg
- 23rd April 2007, 22:51
Hi All,

I always use the line
@ device hs_OSC, wdt_on, pwrt_on, protect_off
or something similar at the beginning of my code to set up the oscillator speed watchdog timer etc.
I usually use PM but now have to use MPASM and it gives me an error on this code.
What is the correct syntax when using MPASM?

Chris

skimask
- 23rd April 2007, 23:34
Hi All,

I always use the line
@ device hs_OSC, wdt_on, pwrt_on, protect_off
or something similar at the beginning of my code to set up the oscillator speed watchdog timer etc.
I usually use PM but now have to use MPASM and it gives me an error on this code.
What is the correct syntax when using MPASM?

Chris

http://www.picbasic.co.uk/forum/showthread.php?t=543

crhomberg
- 24th April 2007, 00:39
Thanks Skimask,

I checked out the thread and had the same problems and tried to fix them the same way but to no avail.
I am just going to keep changing to HS when I program for now as I have a bigger problem.
When I use MPASM 5.03 instead of PM all my serout2 commands seem to send out zeros. Also I programmed a small loop sending out a string and compiled using PM and all worked well, when I did the same with MPASM it would not change even when I deleted lines they kept being there. I changed the setting of INHX in the assembler settings of Mcode Studio and it programmed but again sent blank strings.

Do you have any ideas, I used MPASM in the past without any problems but not this version, is it maybe that the latest version is not compatable?

Regards


Chris

mister_e
- 24th April 2007, 01:07
http://www.mister-e.org/Pics/CrystalBall_Informations.gif
You never told us your PIC # and your __CONFIG line

crhomberg
- 24th April 2007, 16:31
I am using a 16F877A and this is a small program I wrote to test the MPASM.
I compiled it with PM and it flashed the LED and sent the data out to my PC fine.
I compiled using MPASM and the LED doesn't flash and the serial output is a constant string of 8 bit bytes with value 0.

Are there settings for MPASM that I have missed?

Regards

Chris

skimask
- 24th April 2007, 16:41
I am using a 16F877A and this is a small program I wrote to test the MPASM. I compiled it with PM and it flashed the LED and sent the data out to my PC fine. I compiled using MPASM and the LED doesn't flash and the serial output is a constant string of 8 bit bytes with value 0. Are there settings for MPASM that I have missed? Regards
Chris

It would sure help if we could see the program, the configuration lines, the command line used to invoke PBP (if any), any notable options set in any program related to compiling this program...etc...etc...and anything else you can think of that might help...

crhomberg
- 24th April 2007, 16:55
I am using a 16F877A and this is a small program I wrote to test the MPASM.
I compiled it with PM and it flashed the LED and sent the data out to my PC fine.
I compiled using MPASM and the LED doesn't flash and the serial output is a constant string of 8 bit bytes with value 0.

Are there settings for MPASM that I have missed?

Regards

Chris


OOPS!

Here is the code,

'************************************************* ***************
@ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
define osc 20
Include "modedefs.bas"

COUNTER VAR BYTE

COUNTER=0

START:

IF COUNTER= 250 THEN
TOGGLE PORTD.0 'LED TO INDICATE LOOPING
COUNTER=0
ELSE
Serout2 PORTA.0,16390,["COUNTER = ",DEC COUNTER,10,13] 'GOES TO MCSTUDIO SERIAL PROGRAM
'SERIAL SPEED 38400, INVERTED, 8-BITS, NO PARITY
COUNTER=COUNTER+1
ENDIF

GOTO START

crhomberg
- 24th April 2007, 17:20
I found my problem, I had the settings for MPASM in MC studio set to case sensative. When I unchecked that all works fine.

Thanks Guys