12f675 probably a silly question


Closed Thread
Results 1 to 24 of 24
  1. #1
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52

    Default 12f675 probably a silly question

    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

  2. #2
    Kees Reedijk's Avatar
    Kees Reedijk Guest


    Did you find this post helpful? Yes | No

    Default

    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

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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...
    Code:
    @  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
    DT

  4. #4
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default 12f675

    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

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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 ??
    DT

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    PORT TRIS
    -------------
    GPIO TRISIO
    PORTA TRISA ' errr... PORTB?
    PORTL TRISL
    PORTH TRISH
    But... for #7, if there's .... euhhh
    Last edited by mister_e; - 20th November 2006 at 02:43.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    LMAO!! NEVER MIND i contradict myself... and i will leave it like THAT

    Code:
    @GPIO_5=ADCS1
    GPIO_5 con ext
    
    Toggle GPIO_5
    Work and everything assign to 5

    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
    Last edited by mister_e; - 20th November 2006 at 03:18.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  9. #9
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    That's what I'm talking about!

    Functioning Brain Cells.

    &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.

    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>
    DT

  10. #10
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Nice tune, O.K let's try something else...

    Something around ...
    Code:
    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
    Last edited by mister_e; - 20th November 2006 at 04:37.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  11. #11
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    <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.
    Code:
    @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>
    DT

  12. #12
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    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
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  13. #13
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    How do you know that he drinks?





    --------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  14. #14
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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>
    DT

  15. #15
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yup i remind a thread with a little pic with 'I will work for Beer'
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  16. #16
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  17. #17
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Don't let Chinese hear about what you work for!



    -----------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  18. #18
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    oh well a beer it's about a month of their salary anyway...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  19. #19
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    A late entry …
    Code:
    TRISIO = 0
    FSR = $05
    Main:
    INDF.5 = 1
    INDF.5 = 0
    GOTO Main
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  20. #20
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    WOOHOO!

    We have a #8

    <table><tr><td>Way to go Paul! &nbsp; &nbsp; </td><td>
    Now we're cooking with Gas!</td></tr></table>
    <br>
    DT

  21. #21
    Join Date
    Oct 2006
    Location
    Edmonton AB Canada
    Posts
    52


    Did you find this post helpful? Yes | No

    Default 12f675

    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

  22. #22
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    > 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>
    DT

  23. #23
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Meriachee
    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.


    -------------------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  24. #24
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Yeah sometimes it disgress a little bit

    Nice one Paul
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Extreme Noobie question 12F675
    By Jeff in forum mel PIC BASIC
    Replies: 11
    Last Post: - 22nd September 2009, 01:13
  2. Still 12F675 question
    By F1CHF in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 7th August 2009, 21:09
  3. 12F675, MPLAB programming question
    By EASY in forum General
    Replies: 0
    Last Post: - 2nd April 2006, 19:28
  4. 12f675 programming question
    By puggy in forum General
    Replies: 3
    Last Post: - 30th November 2004, 23:34
  5. 12f675 internal osc question.....
    By Gabe@SPdFtsh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th January 2004, 06:33

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts