Please help a new guy get going with a PIC10F222


Closed Thread
Results 1 to 12 of 12

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    data sheet section 4.5 OPTION REGISTER

    Now try
    Code:
    @ Device PIC10F222, IOFSCS_4MHZ, MCPU_OFF, WDT_OFF, PROTECT_OFF, MCLR_OFF
    OPTION_REG.5=0 ' TOCS = FOSC/4
    ADCON0 = 0
    TRISIO =0
    GPIO = 0
    
    Start:
        high gpio.2 'test
        high gpio.0
        high gpio.1
    
        pause 500
    
        low gpio.2
        low gpio.0
        low gpio.1
    
        pause 500
    
        goto start
    Last edited by mister_e; - 29th May 2006 at 14:36.
    Steve

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

  2. #2
    Quacker's Avatar
    Quacker Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve!

    I was hacking around last night and finally figured out the "OPTION_REG.5 = 0" To show you how new I am, I didn't know 'til then that I could actually change a specific register bit, let alone that the OPTION register was actually called the OPTION_REG!

    BTW, Jeff at MELabs confirmed that the ADCIN command does not run properly on this chip (yet?). The command executes but stuffs the answer in the adres register, not the one you specify.

    All-in-all though, a pretty impressive little chip.

    Best,
    Q

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


    Did you find this post helpful? Yes | No

    Default

    it's not so hard to do your own ADCIN so far. Just writing and reading the according register. It's pretty well explain in the datasheet. Will be faster and much code efficient.
    Steve

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

  4. #4
    Quacker's Avatar
    Quacker Guest


    Did you find this post helpful? Yes | No

    Smile

    Thanks,

    As soon as I figured out that I could have my way with individual register pins, everything got easier. I am also wondering if there are any clever tricks out there that I can use to fit in a few more VAR's. I'm out of space and my program isn't quite finished.
    Last edited by Quacker; - 31st May 2006 at 01:22.

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


    Did you find this post helpful? Yes | No

    Default

    if you can, post your code here. We may see few thing to be shrink. Next step.. switch to a bigger one... like 12F675 or my favourite one 12F683.

    512 Byte is really easy to fill... worst when using ANY Basic or C compiler.

    Unfortunately those baby 10F don't have internal EEPROM... busted!
    Last edited by mister_e; - 31st May 2006 at 03:36.
    Steve

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

  6. #6
    Quacker's Avatar
    Quacker Guest


    Did you find this post helpful? Yes | No

    Talking Apples and Oranges?

    I have enough memory for program (512 bytes) but not for data (23 bytes). What I was just thinking of, was to use generic VAR's instead of specific ones, on the theory that if a VAR was used in only a segment of the program, that I might borrow the space and reuse it later in the same progam. Sort of like this example where instead of using a "basket for apples" and a "basket for oranges" I use basket#1 over and over:

    start:

    Get number of apples
    put in basket#1
    Divide by number of children and distribute
    .
    .
    .
    (Sometime later if I'm really done with the apples)

    Get number of oranges
    put in basket#1

    Divide by number of children and distribute

    clear basket#1 (optional)
    goto start

    My software friend almost fainted at the prospect but in a pinch, it could save me from running out of data memory and thus save the SOT23-6 from becoming an SOIC-8, right?

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


    Did you find this post helpful? Yes | No

    Default

    still unsure of everything 'round what i suggest, but i guess the EXT modifier could help you on that. Darrel may confirm that thought. I have to experiment around this one when i'll find time... there's still some healling to do here and pending project to finish first

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

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

Similar Threads

  1. I2C with a PIC10F222 - is it possible
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th September 2009, 04:01
  2. Help with waking a PIC10F222
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd August 2009, 02:08
  3. Programming PIC10F222
    By brid0030 in forum General
    Replies: 5
    Last Post: - 19th August 2009, 22:43
  4. I shut this guy down
    By T.Jackson in forum Off Topic
    Replies: 5
    Last Post: - 25th May 2007, 03:27
  5. Danger ...unfair Guy
    By Acetronics2 in forum Off Topic
    Replies: 3
    Last Post: - 10th September 2005, 11:57

Members who have read this thread : 0

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