PDA

View Full Version : Stupid question



Meriachee
- 19th June 2007, 04:40
Hi folks,

I've got a 12f675 with a very simple piece of code to flash 2 leds. It won't start. THere's power, it programs fine and everything appears to be fine - except.

Do I need to put some kind of define at the top to tell it specifically to not use MCLR?
This is what I've got at the top:

@ device pic12F675,intrc_osc_noclkout,wdt_off,mclr_off,prot ect_off

CMCON = 7
ANSEL = 0

The compile fails at the define.

It's something dumb, it always is......
Gary

Ioannis
- 19th June 2007, 07:59
May be it is the space at the prot ect_off

Ioannis

mister_e
- 19th June 2007, 08:28
What error message do you have?


Warning[207]: Found label after column 1. (device)
Error[122] : Illegal opcode (pic12F675)

if so, you need to change your syntax to use MPASM one.

this should be something like..

@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF

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

Meriachee
- 16th July 2007, 04:54
No errors when compiling. It looks as if the chip isn't starting. Help? (Also, this forum changes Caps. Makes the code look like the variables are whacked....

@ device pic12F675,intrc_osc_noclkout,wdt_off,mclr_off,prot ect_off

'Output variables and port assignment.
Output GPIO.1
Led1 var GPIO.1
low led1

output GPIO.2
Led2 var GPIO.2
low led2

pause 50

loop:
high led1
pause 500
low led1
pause 100
high led2
pause 500
low led2
pause 100

goto loop

end

mackrackit
- 16th July 2007, 05:24
To each their own, but I have better luck modifying the *.inc file for the configs.

One thing I do not see is "DEFINE OSC 4" at the top of your code. If it is there then this is a good reason to use the CODE brackets and post your whole code.

Try this

DEFINE OSC 4

ANSEL=%00000000
CMCON=7

LOOP:

HIGH GPIO.2
PAUSE 100
LOW GPIO.2
PAUSE 100

GOTO LOOP


When you have a problem like this go basic.. no variables, one piece of hardware and so on.

This is my 12F675.inc set up


NOLIST
ifdef PM_USED
LIST
include 'M12F675.INC' ; PM header
device pic12F675, intrc_osc, wdt_on, pwrt_on, mclr_on, protect_off
XALL
NOLIST
else
LIST
LIST p = 12F675, r = dec, w = -302
INCLUDE "P12F675.INC" ; MPASM Header
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _CP_OFF
NOLIST
endif
LIST

Are you using PM or MPASM?

Meriachee
- 16th July 2007, 14:59
Dave,

I have tried both assemblers. I had things working just fine on another PC, and since I've re-installed, nothing seems to work, even opening any of the other files for completed projects. When I put in lines like:
device pic12F675, intrc_osc, wdt_on, pwrt_on, mclr_on, protect_off
I get errors, "cannot overwrite" and other strange things, like it doesn't like the comma or the space. I will try your suggestion this evening and see where that leads.

Gary

mackrackit
- 16th July 2007, 15:22
Did you by chance get a new machine with Vista?

http://www.picbasic.co.uk/forum/showthread.php?t=6109&highlight=vista
is an interesting thread.

Pic_User
- 16th July 2007, 15:23
Hi Gary,

(Also, this forum changes Caps. Makes the code look like the variables are whacked....)


If it is there then this is a good reason to use the CODE brackets and post your whole code.
To use the “Code Brackets” see the “vB code” Hot button in the “Posting Rules” box at the bottom left of the screen while you are posting.

It puts the code in the special box that protects the format better that the normal forum posting does...
Hope that helps,
-Adam-

Meriachee
- 16th July 2007, 16:14
Dave,

No, it's a relatively brain-ded Dell with XP. That's enough fun for one day :) I am not surprised that Vista is a whole new can of worms. It probably explains why people just get fed up and go cut the lawn or something.....

Code brackets. Who knew. (Fortunately for me, I've completely accepted that information going in one side causes something equal in size to leak out the other side - I'm ok with vBulletin changing the case, although it makes it look like PBPro doesn't see the variable.)

Gary

Meriachee
- 17th July 2007, 03:07
Ok, I'm going to cut the grass. ( and maybe find an all new and interesting use for the clippings!)

So, Dave, I built EXACTLY the test code you posted. No more, no less. Using the following:
MCS 2.3.0
PBPro 2.47
MPASM 5.03
Epic Plus



DEFINE OSC 4

ANSEL=%00000000
CMCON=7

LOOP:

HIGH GPIO.2
PAUSE 100
LOW GPIO.2
PAUSE 100

GOTO LOOP


No errors, no warnings. Device programs just fine. Led blinks more or less where and when it should on the programmer. Splash returns with "fat dumb and happy". Insert the chip into the proto board socket, power it up, no run. Verified, tested each and every power feed, ground, led operation, 5v across the chip just as it should be.
As my boss would say, and with appologies to anybody, wtf.

mackrackit
- 17th July 2007, 11:01
Hi folks,

I've got a 12f675 with a very simple piece of code to flash 2 leds. It won't start. THere's power, it programs fine and everything appears to be fine - except.

Do I need to put some kind of define at the top to tell it specifically to not use MCLR?
This is what I've got at the top:

@ device pic12F675,intrc_osc_noclkout,wdt_off,mclr_off,prot ect_off

CMCON = 7
ANSEL = 0

The compile fails at the define.

It's something dumb, it always is......
Gary
At least it compiles now.:)

Awhile back someone had a similar problem. After 40 post the problem was solved - bad port on computer. http://www.picbasic.co.uk/forum/showthread.php?t=6160

Being that everything worked on one machine but not another and the simple test did not work, I think I would now look at the machine.

Archangel
- 17th July 2007, 20:40
Ok, I'm going to cut the grass. ( and maybe find an all new and interesting use for the clippings!)

So, Dave, I built EXACTLY the test code you posted. No more, no less. Using the following:
MCS 2.3.0
PBPro 2.47
MPASM 5.03
Epic Plus



DEFINE OSC 4

ANSEL=%00000000
CMCON=7

LOOP:

HIGH GPIO.2
PAUSE 100
LOW GPIO.2
PAUSE 100

GOTO LOOP


No errors, no warnings. Device programs just fine. Led blinks more or less where and when it should on the programmer. Splash returns with "fat dumb and happy". Insert the chip into the proto board socket, power it up, no run. Verified, tested each and every power feed, ground, led operation, 5v across the chip just as it should be.
As my boss would say, and with appologies to anybody, wtf.

Hi Meriachee,
Go back and re read post 3, from mister_e, Unless you have set the config fuses in code or manualy at program time it will program without them but not run.
JS
oh BTW
The only question which is stupid is the one you are too timid to ask, because it goes unanswered.

Bruce
- 17th July 2007, 20:59
Before you program the PIC, try setting config manually. I.E. select intrc osc,
and mclr off. Then click the save button, and try programming it. Does it
work?

Is there a check mark next to 'Update Configuration From File' & 'Reread File
Before Programming' under the Options menu?

This forces the programmer software to reload the new .hex file before
programming and use the config settings embedded in the .hex file.

Unless you have a bad PIC, that's all I can imagine that would cause this.

Meriachee
- 20th July 2007, 01:30
The nagging possibility that there was a hardware error was never far from me during this line of questioning, and once again, the blasted hardware was at fault.

Installed the same services on another machine, watched the same routine do more or less the same things, plug the same chip into the socket and lit 'er up. Watching leds blinky blink. (just like they should)

Thank you to all who responded to my questions, appologies that there never really was anything PIC related at fault. (It's ALWAYS something stuipd)

Gary

mackrackit
- 20th July 2007, 04:08
Thank you to all who responded to my questions, appologies that there never really was anything PIC related at fault. (It's ALWAYS something stuipd)

I am sure something like this has happened to all of us. I know it has happened to me more than once.:eek:

Archangel
- 20th July 2007, 05:47
It happens a lot less to me since I bought some new proto boards!