Need 4 modes with just 3 switches - need all modes to be selectable QUICKLY!


Closed Thread
Results 1 to 40 of 68

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Drop a copy of DT_INTS-14.bas and ReEnterPBP.bas in the same directory as the file you're compiling, or save the file to the same directory they're already in.
    Regards,

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

  2. #2
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Drop a copy of DT_INTS-14.bas and ReEnterPBP.bas in the same directory as the file you're compiling, or save the file to the same directory they're already in.
    Thanks Bruce.....that seems to have got rid of the majority of my errors.

    After dropping it into the right directory 9there was one in there...but it must have been ab older version?), I did get some relating to wsave, a judiscous amount of trial & error with commenting the DTS_INTS-14.bas....

    Code:
    wsave   VAR BYTE    $20     SYSTEM      ' location for W if in bank0
    'wsave   VAR BYTE    $70     SYSTEM      ' alternate save location for W 
                                             ' if using $70, comment out wsave1-3
    
    ' --- IF any of these three lines cause an error ?? ---------------------------- 
    '       Comment them out to fix the problem ----
    ' -- It depends on which Chip you are using, as to which variables are needed --
    wsave1  VAR BYTE    $A0     SYSTEM      ' location for W if in bank1
    wsave2  VAR BYTE    $120    SYSTEM      ' location for W if in bank2
    'wsave3  VAR BYTE    $1A0    SYSTEM      ' location for W if in bank3
    ' ------------------------------------------------------------------------------
    Now the only error I have left is this one....

    Error [118] [filepath]test_ioc.asm Overwriting previous address content (2007)

    ....which I'm without a clue how to sort! (help!)

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


    Did you find this post helpful? Yes | No

    Default

    The last error is because you have config settings in your code, and in your 16F690.INC file.
    Last edited by Bruce; - 7th August 2010 at 18:09.
    Regards,

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

  4. #4
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    The last error is because you have config settings in your code, and in your 16F690.INC file.
    Success!!! (both with the compilation and on the breadboard!) ie if I Press switch 1 the LED blinks once, press Sw2 blinks twice etc - you'd never have thought a couple of blinking LEDs could make a grown man so happy!)

    Many *many* thanks Bruce for hanging in there with me - now off to have a dabble (& work out what you've done!)

  5. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Ok, having just dabbled with this on breadboard for a short while, my immediate thought is that the wait for the finger being lifted from the switch, ever so slightly delays the led from lighting up instantly... which makes the actual switch depress feel a tad unresponsive.

    Without the wait, then there's obviously going to be another interupt when the finger is removed - but is this such a concern? - can't this second interupt be ignored with dedicated code?

  6. #6
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Poor Bruce ...

    It's not a book upon PBP he'll have to write , but a 32 parts encyclopaedia ...

    sure this explains ...

    No, no, Bruce, please , ... do not strike the head

    Regards
    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 " !!!
    *****************************************

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    ??

    I'm not locked into your groove there ....just feeding back what I'm experiencing. The led obviously lights up after removing the finger from the switch, which sounds fine on paper but in practise it feels a little weird to the senses (ie I guess a lifetime of pushing buttons that immediately light up, is messing with my own grey matter - "Does not compute"!!)

    By the way, I'm not asking for anyone to write further code (Bruce has gone beyond the cause here!) ....just bouncing ideas of you all! IOC is all new to me - using the three diodes and the INT pin was ultra responsive....just wondering what ideas can be tabled to make IOC feel similar.
    Last edited by HankMcSpank; - 7th August 2010 at 20:24.

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Hank ( Humour ON : I do love how this sounds ...)

    seriously,

    I think twisting the Switch: and Process: labels could do it... at first sight.

    Alain
    Last edited by Acetronics2; - 7th August 2010 at 21:02.
    ************************************************** ***********************
    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 " !!!
    *****************************************

  9. #9
    Join Date
    Aug 2009
    Location
    Paso Robles California
    Posts
    167


    Did you find this post helpful? Yes | No

    Default 4 modes

    I have a question about this setup you can get 4 modes from two switches or do you really need 5 modes or no_mode also. could you always start in mode 1 which would be no button pressed? mode 2 left button, mode 3 right button, mode 4 both buttons, it would be smaller.
    sorry I may not have followed this thread correctly.

  10. #10
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by l_gaminde View Post
    I have a question about this setup you can get 4 modes from two switches or do you really need 5 modes or no_mode also. could you always start in mode 1 which would be no button pressed? mode 2 left button, mode 3 right button, mode 4 both buttons, it would be smaller.
    sorry I may not have followed this thread correctly.
    Thanks for your contribution, since you've asked, then here's bit more meat on the bone wrt the switching!

    The is for a guitar widget...as such the control box that the final pcb will be going into will be rather very small - I can actually only shoehorn four momentary (6mm square) switches in there - one of these switches acts as an analogue signal 'kill switch' (it simply shorts the guitar signal to ground giving a gated type effect - guitarist love kill switches!) The fourth switch is not integrated into the PIC circuitry at all - that leaves three switches.

    Ok, wrt the switching itself....when external power is unit is applied to the circuit, it just sits there waiting in standby for one of the switches to be pressed

    Now I could have used just one switch & have the player toggle through the differnt modes - but the modes are used in such a way, they need to be instantly accessible., hence...

    Pressing Switch1 takes the unit out of standby & instantly into Mode 1
    Pressing Switch2 takes the unit out of standby & instantly into Mode 2
    Pressing Switch3 takes the unit out of standby & instantly into Mode 3

    once the unit is active (ie in Mode 1, 2 or 3), you can switch between modes freely by just pressing any of the other switches (in other words, you don't have to deacrivate a mode by pressing the dedicated switch again, prior to selecting another switch/mode).

    the unit is deactivated by pressing on the switch for whichever mode is active, so if Mode 2 is active, press mode 2 switch & the unit goes into standy again ( an LED gives visual representation of whichever mode is active)

    That's pretty much the background - what flushed out this thread was me seeking ideas how to squeeze a 4th, 5th mode etc out of the three switches - obviously such requirements starts invoking double presses, holding switches down for longer or pressing two switches at once (I've still not decided on the final version ...but for now I've settled on pressing two switches together to get a 4th mode)

    Then Bruce came along - took a look at the way I'd implemented my interrupts on my schematic ...and chimed in that by changing the interrupt type from the shared 'INT' pin....to Interrupt on Change - I could save on some components/space. That was a fantastic bit of input, but then I hit some issues (I didn't know how to implement IOC - Bruce sorted this....then I got some compilation errors when I tried to combine IOC Interrupts & TMR1 Interrupts ....Darrel has hopefully sorted the latter)

    And you're pretty much bang up to date - the thread has took a few bends & curves...but I now know how to implement IOC interrupts, I've therefore saved some space on my (crammed PCB), this has allowed better track layout (but has also meant I've had to redesign my PCB....but worse, redesign/rebuild my test tig (I have a hinged pogo pin endowed test/debug setup - this allows me to program my PIC in situ, as well as facilitating a debug pin (I use the PICKIT2 UART2 to view stuff on my PC) as well as test points for monitoring the analogue aspect of the circuit etc)...



    (you can see the four switches I'm referring to on the PCB above - that space to the left will be filled up with other stuff so it's not free space)

    The closer I get to finishing this project - the further the goalposts seems to get away!


    I'm now using the downtime wrt my interrupt probs being sorted by Darrel, to hack an old eprom eraser my work was throwing away to reutilize as a UV lightbox (with a nice new PIC countdown timer) - I'v just removed the old clunky analogue switch....



    I started work on the UV Timer program (& PCB) earlier this afternoon - hope to have it finished over the weekend!
    Last edited by HankMcSpank; - 13th August 2010 at 20:03.

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


    Did you find this post helpful? Yes | No

    Default

    Spanky,

    I've finished the changes to DT_INTS-14.
    You can download the new files from http://www.darreltaylor.com/DT_INTS-14/downloads.htm

    Anyone else using ver 1.00 should get them too.

    In trying to add some optimization to ver 1.00, I introduced a problem that caused the error when the Handlers crossed a Page boundary.
    I'm pretty sure that's fixed now.

    In your program it was right at the edge, and only 1 of the handlers crossed the boundary, which is why commenting one of them allowed it to compile.

    It also gave me a chance to fix a problem caused by MPLAB 8.53 when using 16F1 chips.


    Thanks again for bringing the problem to my attention HankMcSpank.
    DT

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