Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15

Thread: Revolution PIC Programmer

  1. #1

    Default Revolution PIC Programmer

    I bought one of these back in 2003. It does not compile certain PICAXE codes (Readtemp is a known example) for reasons of code confidentiality. I'm OK with that but I'm wondering if there is an upgrade available to reflect the newer/more modern codes, specifically IRout which I want to use.

    Having looked at the pin waveforms from the native picaxe endlessly sending IRoutit "irout 0,1,101" it is going a LOT faster than this following code snippet does, even at 32MHz. (on an 08M2)
    setfreq m32
    do
    high 1
    low 1
    loop
    This manages a square wave with a Mark : Space ratio of 1:3 at 180uSec per cycle. (about 5,555 Hz) Nowhere near the 26uS stream needed for IR>>

    So I'll answer my own question probably, IROUT is not supported by the PIC Programmer...... clever how they manage to make it deliver the IR individual pulses at 26uS though, within much slower code.

    Comments anyone?

  2. #2
    Senior Member
    Join Date
    Jan 2011
    Location
    UK
    Posts
    4,224
    Blog Entries
    12

    Default

    26 microseconds is approximately 38KHz. This is the carrier for the signal - the signal itself is actually much slower.

    It is certainly possible to bit-bang IR (e.g. Philips RC-5 IR output on PICAXE) and the signal can be modulated onto a carrier by using a separate pin with PWM capability for the carrier and use an AND gate or transistors to combine the data with the PWM, or it might be possible to turn the PWM on and off on a pin instead.

    The 3-pin IR receiver demodulates the signal when it is received so the output of that will not show the (relatively) high frequency modulation.

  3. #3

    Default

    I should say that I'm NOT sending any IR code as such, I needs a 'gated' 38KHz drive signal within certain specs. Room for an 8 pin pic, nothing else.

    Hmm, well that's a useful tip, use the PWM. A quick 'wizard' does indeed produce 50% duty cycle at 26usec, even at 4 MHz clock too! Guess its using the internal PWM module 'outside' PICAXE basic, but there is only the one in an 08Mx.
    Two things I need to try and do now..... (a) count 11 cycles of the 38KHz then stop for 9.3 mSec (b) and provide the INVERSE of the PWM to another output pin.

    I think an easier resolution is going to be use a simple listing that will translate to assembler, then edit the pauses it adds to make the code run at the same speed as a picaxe would. I can see a way through....I think.

    Just tried it on the REVED pic programmer, PWMout is not supported....

  4. #4
    Senior Member
    Join Date
    Jan 2011
    Location
    UK
    Posts
    4,224
    Blog Entries
    12

    Default

    Quote Originally Posted by radiogareth View Post
    (a) count 11 cycles of the 38KHz then stop for 9.3 mSec
    Have you tried the pwm command? Is that supported?

    Quote Originally Posted by radiogareth View Post
    (b) and provide the INVERSE of the PWM to another output pin.
    I don't think that can be easily done or even done at all without assembler. The PICAXE-08M2 does not support hpwm which would enable you to produce an inverted signal. Is there enough room for a surface mount transistor to invert the signal if you use a surface mount PICAXE?

  5. #5

    Default

    OK, this is close although the burst of PWM is too long, but PWM is not supported by the assembler either :-(
    Now my picoscope usb leads has gone U/S so I have to find a spare usb A to b lead.

    Code:
    setfreq m8
    main:
    pwm C.4,128,1 ; send 1 pwm bursts out of pin 4
    pause 8 ; pause 8 ms
    goto main ; loop back to start
    Although this would probably work, I would need it in assembler for the end user......

    An interesting exercise in learning about picaxe though....thanks :-)

  6. #6
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    20,055

    Default

    It might be possible to generate what you want with an 08M2. If you could provide a full spec of what you need it will help, as will an indication of what it is to be used for.

    The first step is working out if what a PICAXE can generate will be usable or whether the specification is too stringent for a PICAXE to meet. For example, does it have to be exactly 11 full cycles of 38kHz pulses, can there be more or less, can there be part pulses, does it need to have an exact repeat time of 9586us ?

  7. #7

    Default

    OK, fair comments....

    I have been asked to produce an endless sequence of pulses comprising 300uSecs duration made up of 26uSec cycles time with a gap of 9.3mSecs between each cycle.
    I need the anti-phase of the square wave (apart from the 9.3 Msec off part) to appear on another pin - this is for anti-phase driving of the emitter.

    I doubt the absolute number of pulses or the timing between them is critical within to 5%, it is basically an IR based system that needs these approximate timings to keep it happy.

    Ideally I need to be able to turn it into assembler via the REVED programmer. Edit: Interesting, I can't find the Serial PIC programmer listed anymore to see if they say what it will won't do etc.
    Last edited by radiogareth; 06-04-2013 at 15:41.

  8. #8
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    20,055

    Default

    This should do the job with an 08M2 but may need tweaking with a logic analyser to get timing how you desire. It's 11 or 12 pulses of 38kHz with an approximate 9.3ms gap when I examine it.

    The pulses are output on Pin 0 and are positive going but can easily be made negative going. Not sure why there needs to be a separate inverse signal 'to drive the emitter' as just one signal can control current through the IR LED to turn it on or off. The output on pin 2 is however an anti-phase 38kHz output.

    Code:
    #Picaxe 08M2
    
    Low 1
    PwmOut 2, 25, 53
    
    PokeSfr $FC, %11000000 ; SFR $39C MDCON
    PokeSfr $FD, %10000001 ; SFR $39D MDSRC
    PokeSfr $FE, %00100000 ; SFR $39E MDCARL
    PokeSfr $FF, %01100100 ; SFR $39F MDCARH
    
    Do
      PulsOut 1, 30
      PauseUs 740
    Loop
    Use the following to invert polarities -

    Code:
    PokeSfr $FC, %11010000 ; SFR $39C MDCON
    PokeSfr $FD, %10000001 ; SFR $39D MDSRC
    PokeSfr $FE, %00100000 ; SFR $39E MDCARL
    PokeSfr $FF, %00100100 ; SFR $39F MDCARH
    The BAS800 PIC Programmer details are in the store -

    http://www.techsupplies.co.uk/bas800

    You probably could do what you want but likely easier to write that as bit-banged code in Assembler, or tune HIGH-PAUSE-LOW-PAUSE code converted from Basic. The BAS800 is an educational tool with limited capabilities so it won't convert the above code into Assembler.
    Last edited by hippy; 06-04-2013 at 18:46. Reason: Invert polarity code addition

  9. #9

    Default

    Thanks Hippy. I will try that tomorrow, been away from pc today:-( Thanks for the link to the programmer too, not least for the capabilities it offers.

  10. #10

    Default

    Morning Hippy, Yes that works nearly as intended, output 2 is the inverse 0 but it runs continuously, ideally I'd need it to be pulsed for the same duration as 0. I don't begin to understand how the code works, (a quick search says Advanced users only!!) but remain amazed by what can be achieved.

    I also noticed the pauseUs which is a new one on me - not that I need it for flashing some LEDs on and off.:-)

    Thanks

Bookmarks

Posting Permissions

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