PDA

View Full Version : 12f675 probably a silly question



Meriachee
- 19th November 2006, 19:50
Hi folks,

I've been using 16f819s for a while now and needed a smaller package for a space restricted installation, so I got a handfull of 12f675s.

I'm using PBP and the 4.x melabs programmer and putting a 4k7 to vdd for MCLR. Nothing else is being set specifically, except of course intosc, watchdog enabled, brownout enabled and powerup enabled.

The chip will not start. All I did to test it was put a 220 to a led from GP5, pretty standard test.

Checked voltages and led wiring and everything is as it should be.

Is there startup files that need to be included with this chip?

help?

Gary

Kees Reedijk
- 19th November 2006, 21:18
I tried this code and that should work:

'flash that led!
@ device pic12F675, intrc_osc, wdt_on, pwrt_on, mclr_off, protect_off

ANSEL = 0
CMCON = 7
TRISIO = 0
GPIO = 0

LED VAR GPIO.5

loop:
Toggle led
Pause 100
goto loop

End

Darrel Taylor
- 19th November 2006, 21:36
Hi Gary,

It's hard to tell without the code you're using, but here's something to look at.

INTOSC, is the same as INTRC_OSC_CLKOUT. Which means that FOSC/4 (1mhz) will be put out on GP4. If you have an o-scope, you can look for this signal to see if the processor is running or not.

If there is anything attached to GP4, it could also cause the chip to reset from over-current.

>> I'm using PBP and the 4.x melabs programmer

Is that 4.1? If so, look at the Code window in meProg.exe. (View | Memory)
Open the HEX file and press the program button. Now look at location 0000 in the code window. Has it changed?

There's a bug in that version that sometimes causes the first word to change to 0000h, which makes the program not run. If that's the case, you can download the 4.2 beta from the melabs website.

Here's a simple blink program for the 12F675...
@ device pic12F675, intrc_osc_noclkout, wdt_off, mclr_off, protect_off

CMCON = 7
ANSEL = 0

Main:
TOGGLE GPIO.5
pause 500
goto Main
<br>

ADDED: Kees, intrc_osc isn't valid for a 12F675

Meriachee
- 19th November 2006, 22:15
Thanks guys. It's always something stuipd, and this time is no exception. If you want a GPIO port to be a port, you have to define it as a GPIO.x not portb.x as I am obviously far too accustomed to. Ports were not defined as evidenced by the floating voltage.

She's avery pretty blinking led!

Thanks again.
Gary

mister_e
- 19th November 2006, 23:13
PORTB is already define but leads you to Register addr 6... wich is unimplemented on this PIC

PORTA is assign to register addr 5, wich is GPIO

in the above, if you replace GPIO by PORTA, it will work.

Not a good practice but...

Darrel Taylor
- 20th November 2006, 00:12
Hmm, never realized PORTA and B were in there.
That's odd about PORTB pointing to an unimplemented register. It keeps the compiler from finding problems like what Gary had.

12F675 How do I address thee, let me count the ways.<pre>PORT TRIS<br>-------------<br>GPIO TRISIO<br>PORTA TRISA<br>PORTL TRISL<br>PORTH TRISH</pre>or you can use PIN numbers...<pre>HIGH 5 ; will set GPIO.5 to OUTPUT HIGH<br>or <br>TOGGLE 5</pre>Although a bit strange...

<pre>TOGGLE 13 ; will also toggle GPIO.5</pre>
OK, so that's only 6, who's got number 7 ??

mister_e
- 20th November 2006, 02:12
PORT TRIS
-------------
GPIO TRISIO
PORTA TRISA ' errr... PORTB?
PORTL TRISL
PORTH TRISH


But... for #7, if there's .... euhhh :(

mister_e
- 20th November 2006, 02:58
LMAO!! NEVER MIND i contradict myself... and i will leave it like THAT :D



@GPIO_5=ADCS1
GPIO_5 con ext

Toggle GPIO_5

Work and everything assign to 5 :D

So i guess we could talk more than 7... for what it worth ;)

@GPIO_5=RAM_START-15
GPIO_5 con ext

and so on

Darrel Taylor
- 20th November 2006, 04:16
That's what I'm talking about!

Functioning Brain Cells. :D

http://www.darreltaylor.com/files/ROFL.gif &nbsp; @GPIO_5=ADCS1

But really, it's just a GPIO_5 CON 5. So I'm not going to give you #7 on it. :p

You're so close.
When I first looked, I thought you had it. But after a second glance, the buzzer went off.

<script type="text/javascript" src="http://www.darreltaylor.com/files/AudioDo2.js"></script><script>WriteSound("Thinking","http://www.darreltaylor.com/files/jeopardy.wav")</script>
<table><tr><td width=150 onMouseOver="PlaySound('Thinking')">This Might Help</td><td>(except for dwayne)</td></tr></table>

mister_e
- 20th November 2006, 04:20
Nice tune, O.K let's try something else... :D

Something around ...


asm
PORT1=ADCS1
PORT2=GPIO
PORT3=TRISIO-0x80
endasm
PORT1 VAR BYTE EXT
PORT2 VAR BYTE EXT
PORT3 VAR BYTE EXT
Toggle PORT1.5
Toggle PORT2.5
Toggle PORT3.5


;)

Darrel Taylor
- 20th November 2006, 04:49
<embed NAME="RimShotSound" SRC="http://www.darreltaylor.com/files/rimshot.wav" AUTOSTART="true" WIDTH="0" HEIGHT="0">
We have a Winner!

But I liked the way you had it at first, better. :o
@GP=5
GP VAR BYTE EXT

TOGGLE GP.5

Ok, so let's see what you have won ...... what have I got here ....

Congratulations!, you've won my respect as a programmer.
Oh, wait a minute, you already had that.

I need to get a sponser, give away some cool stuff :)
<br>

mister_e
- 20th November 2006, 04:54
Well you teach it to me on the EXT modifier thread, so i'm only a good student...

Here's what i have for you.. mmm

http://www.mister-e.org/Pics/Beer_6pack.gif

sayzer
- 20th November 2006, 08:42
How do you know that he drinks?


:)


--------------------------

Darrel Taylor
- 20th November 2006, 09:00
I thought it might be evident from some of my earlier posts.

But if it's not showing through .... I guess it's ok to have another one of those "Darn Good" Beers. :)
<br>

mister_e
- 20th November 2006, 09:02
Yup i remind a thread with a little pic with 'I will work for Beer' :D

mister_e
- 20th November 2006, 09:09
there you go
http://www.picbasic.co.uk/forum/showpost.php?p=27182&postcount=8

sayzer
- 20th November 2006, 09:24
Don't let Chinese hear about what you work for!

:)

-----------------------

mister_e
- 20th November 2006, 09:26
oh well a beer it's about a month of their salary anyway... :D

paul borgmeier
- 20th November 2006, 17:46
A late entry …

TRISIO = 0
FSR = $05
Main:
INDF.5 = 1
INDF.5 = 0
GOTO Main

Darrel Taylor
- 20th November 2006, 20:14
WOOHOO!

We have a #8

<table><tr><td>Way to go Paul! &nbsp; &nbsp; </td><td>http://www.darreltaylor.com/files/fire3_red.gif
Now we're cooking with Gas!</td></tr></table>
<br>

Meriachee
- 20th November 2006, 23:33
So, I'm confused. Why would you define the port as anything except a gpio?

Also, I keep seeing statements at the top of the code that starts with "@", but when I put that in, the compiler gets all cranky..

Gary

Darrel Taylor
- 21st November 2006, 05:22
> Why would you define the port as anything except a gpio?

Absolutely no reason at all. Unless you just want to be different.

Sorry for the confusing variants.

We're just having a little mental exercise about how many ways you could reference a pin on a 12F675. I guess your question provided a good place to have some fun.

I think everyone will agree that GPIO is the proper way to go. But knowing if there's something better is .. well, better.
<br>

sayzer
- 21st November 2006, 05:40
So, I'm confused. Why would you define the port as anything except a gpio?

Also, I keep seeing statements at the top of the code that starts with "@", but when I put that in, the compiler gets all cranky..

Gary


Meriachee,

If you like to see how it goes, try posting a working code say 20 lines, and then ask here that you need the code with less code size.

And then watch what will happen.


-------------------------------

mister_e
- 21st November 2006, 14:22
Yeah sometimes it disgress a little bit :D

Nice one Paul :D