Recent content by popchops

  1. P

    Best way to interface with rotary encoder

    That's very interesting... I'm only aiming for stereo volume and source selection, but with digital control because I'm fed up with crackly pots and switches. At the moment, I'm thinking of hiding the IRIN in an ELSEIF clause in the main loop: If bCurrentState <> bPreviousState Then Then...
  2. P

    Best way to interface with rotary encoder

    Hi Alan, I managed to make your version work with a bit of bashing around. It's very good - the best yet I think. Tested and proven to decode ~100 edges per second (without error) on my 40X2 at 16 MHz. That's approaching the limits of my encoder. Wow. Here's the working code: ;Simple Rotary...
  3. P

    Test circuit for MD20A with feedback pot

    I just found this thread, which is a bit more interesting than my problem! You made a proportional controller, where you are setting the output PWM proportional to your calculated error or 'diff'. Pretty nice way of slowing down to get greater fidelity close to the setpoint. Is there any load...
  4. P

    Best way to interface with rotary encoder

    Hi all, Next question... if it's not too bold... is how to integrate infra-red receiver with the encoder as inputs to the same picaxe...(?) I'm using IRIN which has an optional timeout... I always used values around 100 ms which works very well for INC/DEC demands for volume. However, I...
  5. P

    Best way to interface with rotary encoder

    OK - this is it: ;Simple Rotary Encoder Demonstration Programme ;Written by inglewoodpete #PICAXE 40X2 #Terminal 38400 ;SerTxd at 32MHz #No_Data ;Comment out if EEPROM data is to be initialised ;Tested with Grayhill 62AG11 optical encoder ;Symbol iEncoder0 =...
  6. P

    Best way to interface with rotary encoder

    Yep I suspect you're right, if it takes extra operations to access only the relevant nibble. You can see in the Case code above it's only the LS nibble that's relevant: - E, 8, 1 or 7 indicate CW - 2, B, D or 4 indicate CCW. There's half the number of cases if you ignore previous transitions...
  7. P

    Best way to interface with rotary encoder

    Counter added - works like a charm. Can increment 20 times and decrement 20 times all within 1 second! I pruned out all superfluous reporting, so not ideal for debugging. I also think there is still too much info being recorded. To decide on CW or CCW, INC or DEC, you need only 4 bits: current...
  8. P

    Best way to interface with rotary encoder

    Thanks to inglewoodpete, Latest code detects all edges CW and CCW including first edge after reversal. 'Simple Rotary Encoder Demonstration Programme 'Written by inglewoodpete ' #PICAXE 40X2 #Terminal 38400 'SerTxd at 32MHz #No_Data 'Comment this statement out if...
  9. P

    Hippy

    Woop - That's a relief.
  10. P

    Best way to interface with rotary encoder

    Thanks inglewoodpete, Top tip! I'm running at 16MHz, but I can fix this now.
  11. P

    Best way to interface with rotary encoder

    Hi Alan, Probably not... but I tried the HW SPI and it was so easy and so fast, and as you can see I'm struggling to find enough time to run my loop fast enough without that burden, so I would worry that bit-banging the SPI will take me a while to figure out and will just sap my resources...
  12. P

    Best way to interface with rotary encoder

    Hi inglewoodpete, OK I see - my optical encoder has a detent every edge, only 1 2-bit code per detent. I changed this one line to put current code in the lower nibble: ' This results in previous, current encoder bits appearing in lower nibble bLatestTransition =...
  13. P

    Best way to interface with rotary encoder

    Thanks Alan, that's great news. I'll definitely ditch the debug. I need a chip with HW SPI output (up to 1MHz) to control a PGA2311 digital attenuator, and only the X1 and X2 parts have this feature. I can add an external resonator to get a higher setfreq... this would be worth doing to keep...
  14. P

    Best way to interface with rotary encoder

    Hi Alan - it works! and faster, I estimate maybe 8 edges per second reliably, and detecting every edge so gives me a new count with every detent. Here's the code: init: setfreq m16 ;Quad input A is on C.6 (pin 25) ;Quad input B is on C.7 (pin 26) ;first, determine which state the knob is in...
  15. P

    Best way to interface with rotary encoder

    Hi inglewoodpete - I made some modifications for my pin interfaces (see code comments) and captured some data: 'Simple Rotary Encoder Demonstration Programme 'Written by inglewoodpete ' #PICAXE 40X2 #Terminal 38400 'SerTxd at 32MHz #No_Data 'Comment this statement...
Top