12f629 vs ATtiny 11L


Closed Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Aug 2005
    Location
    Houston, TX
    Posts
    43

    Default 12f629 vs ATtiny 11L

    I saw an article in Nuts & Volts about a voltage booster to power an led flashlight. The oscillator was an ATtiny 11L chip programmed off and on, with a 4mHz internal clock. The article indicated that it would provide a pulse as fast as about 100 kHz. (On 7 us, off 2-3 instructions, 1 us each.)

    So I figured why not try the same circuit using a 12F629, which also has a 4mHz internal clock, programmed the same way. The data sheet (section 10) suggests that each instruction should take about 1 us. Should work the same.

    No dice, the fastest pulse I can get is about 10 kHz, pretty much square. I wrote the program in PIC basic, but I checked the assembler file, and I think it is as simple as possible. I am using pin 0, high and low (no pauses) and loop. (Yes, I disabled the comparator.)

    There has got to be a way. Maybe?

    Thoughts and guidance appreciated.

    A May

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    What about a sooooo .... classical MC 34063 from Freescale ... ??? ... or an UC3842 ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Code:
    @ DEVICE MCLR_OFF, INTRC_OSC, WDT_OFF, BOD_ON, PWRT_ON, PROTECT_OFF
    
    DEFINE OSCCAL_1K 1 ' calibrate internal osc
    
    CMCON = 7
    GPIO = 0
    TRISIO = 0
    
    Main:
        GPIO.0 = 1  ; 1uS ON
        @ GOTO $+1  ; 2uS ||
        @ GOTO $+1  ; 2uS ||
        @ GOTO $+1  ; 2uS ||
        GPIO.0 = 0  ; 1uS OFF
        GOTO Main   ; 2uS || (10uS total)
    That should give you around 100kHz with 7uS ON with 3uS OFF.
    Attached Images Attached Images  
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Aug 2005
    Location
    Houston, TX
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Other chips

    Alain - I don't know those chips. I admit only to a modest understanding of PICs and PIC basic. I have programmers for only PICs and Basic Stamp I's. Additional programmers look expensive for satisfying my curiosity.

  5. #5
    Join Date
    Aug 2005
    Location
    Houston, TX
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Bruce

    You are too advanced for me, I don't recognize the code. I know PIC Basic some, and a little assembler. Up to now, that has been more than enough. But you are giving me hope.

    A May

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    This isn't anything very advanced. @ GOTO $+1 is just a simple assembler instruction
    telling it to goto here (which is the current instructions address) +1, which is just the
    next instructions address.

    This just eats two instruction cycles, and gives you the required delay time in instruction
    cycles to generate the frequency you were looking for.

    The graphic attachment is just an MPLAB logic analyzer screen capture to show you the
    actual timing on the output pin.

    You could do the same thing with just a few @ NOP instructions between the GPIO.0 = 1
    and GPIO.0 = 0.

    It's really simple stuff.
    Last edited by Bruce; - 8th March 2009 at 21:29.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by AMay View Post
    You are too advanced for me, I don't recognize the code. I know PIC Basic some, and a little assembler. ...
    This (see quote above) is why you thought the code was as tight as possible, yet you were only getting 10kHz. PBP is extremely inefficient. It is very simple and very nearly idiot-proof, but most certainly not the compiler to use if you are trying to get tight, fast running code.

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Hi Cliff,

    PBP is extremely inefficient.
    Sorry, but I don't agree with that statement. PBP is quite efficient, and one of the least
    buggy
    BASIC compilers out there.

    It may not produce the tightest code for a BASIC compiler, but it's for sure one of the
    most reliable, and it's very simple to include just a few lines of assembly code when you
    need tight timing like this.

    but most certainly not the compiler to use if you are trying to get tight, fast running code.
    What BASIC compiler would you recommend & why?

    If you know of a PIC BASIC compiler that's more reliable & efficient than PBP, I would
    love to see your test results...;o}
    Last edited by Bruce; - 8th March 2009 at 23:18.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  9. #9
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Chuck Hellebuyck wrote a cool article on Nuts & Volts Magazine (April 2007, and June 2007). It did a quick comparison between different compilers, and I have to say was very surprised. PicBasic Pro fared extremely well.

  10. #10
    Join Date
    Aug 2005
    Location
    Houston, TX
    Posts
    43


    Did you find this post helpful? Yes | No

    Default Got it to work

    While I still have trouble with Bruce's code, I went back to the PIC data sheet, and tried the following code which delivers 113Khz, and the circuit delivers 15.2 volts out to 5 high bright LEDs. 4.5v in at 80ma. The LEDs are quite bright.

    From Microcode studio, using PIC Basic (not Pro.)

    Settings:
    poke $19, $7 'Disable comparators
    low 0
    ASM
    LOOP
    BSF 005H,0 ;set bit 0, Pin 0 high
    NOP ; kill time, 1us
    NOP
    NOP
    NOP
    NOP
    CLRF 005H,0 ;clear bit 0
    GOTO LOOP
    ENDASM

  11. #11
    Join Date
    Sep 2007
    Location
    USA, CA
    Posts
    271


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by languer View Post
    Chuck Hellebuyck wrote a cool article on Nuts & Volts Magazine (April 2007, and June 2007). It did a quick comparison between different compilers, and I have to say was very surprised. PicBasic Pro fared extremely well.
    I would venture to guess that the biggest reason it did so well is because NV refuses to accept articles which contain the Proton compiler. If you eliminate the most competent alternatives, it is easy to say you are the best. And yes, I own both compilers.

  12. #12
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tenaja View Post
    I would venture to guess that the biggest reason it did so well is because NV refuses to accept articles which contain the Proton compiler. If you eliminate the most competent alternatives, it is easy to say you are the best. And yes, I own both compilers.
    This may be true. I have no evidence to prove or disprove this. I do want to make a disclaimer, I am not a PBP or Proton guy. I do own an old version of PBP but have not used it in a long while. I have used C for a long, long time now.

    Regardless, after the initial article Chuck did get quite a bit of information from different camps (including myself from the C camp). And the reason I said I was quite surprised, was that for this test (and the test was quite simple - so one should not read too much into this) Proton and PBP achieved the same speed, as well as CCS C. And HiTech C was only slightly faster.

    I believe the memory usage was better for the C compilers, but cannot say for sure without revisiting the articles and e-mail conversations.

    Most important thing is that beauty is in the eye of the beholder, and what works for one may not work for the other.

Similar Threads

  1. Input problems with 12F629?
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 24th April 2018, 06:25
  2. 12F629 LDR - Light Dependant Resistor
    By Dennis in forum Schematics
    Replies: 15
    Last Post: - 18th February 2010, 22:33
  3. 12f629 config settings
    By Dennis in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st December 2009, 22:39
  4. Basic help for 12F629
    By Gene Choin in forum mel PIC BASIC
    Replies: 5
    Last Post: - 22nd September 2009, 04:06
  5. Servo control with 12F629
    By achilles03 in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd June 2005, 23:34

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