Shop OBEX P1 Docs P2 Docs Learn Events
would i be able to do this with a sx28? — Parallax Forums

would i be able to do this with a sx28?

infinkcinfinkc Posts: 9
edited 2007-02-13 00:20 in General Discussion
i have·4 different (hi/lo) inputs that i want to input to the chip and one output needed

*edit read below
any help much appreciated, im just starting out with programing the sx chips. im use to doing pics.



Post Edited (infinkc) : 2/12/2007 2:52:02 PM GMT

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-02-09 17:50
    Hello,

    ·· This is just simple logic so it would be very easy for an SX to do. There are a few ways to implement it, but if you make a truth table it should make things much easier when you write the code.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-02-09 18:32
    Not unless you’re doing anything timing dependant, such as serial I/O. You could just use the internal RC Osc for this project. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • JonnyMacJonnyMac Posts: 8,941
    edited 2007-02-09 21:28
    If you're just looking for one combination for a true output, it's as easy as:

    Main:
      IF RB = %00111111 THEN
        RA.0 = 1
      ELSE
        RA.0 = 0
      ENDIF
    



    This is not very elegant looking, it's just to demonstrate the point. It also assumes you've made RA.0 an output.
  • Clock LoopClock Loop Posts: 2,069
    edited 2007-02-11 00:39
    infinkc said...
    do i need the 10k resistor on MCLR if im using this chip by itself? power will be applied when turned on.

    you can prolly get away with just connecting it to +5v.. I think the resistor is used to protect the SX from power malfunctions.

    Perhaps if you caused too much current to draw out of one of the pins, or somehow disconnected the +5v supply to the SX then the chip would be powered thru the reset line and that would most likely cause major issues.

    connecting the reset line directly to +5v is ok, I just tried it with my own setup.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Meh. Nothing here, move along.
  • infinkcinfinkc Posts: 9
    edited 2007-02-11 01:07
    Thanks for all the help so far!

    it turns out i only needed to input 3 signals and output one. What im trying to acclomplish:

    when one of the inputs goes HIGH, doesnt matter what one, i want the output to go·HIGH also

    my code so far

    LCD_Power·· PIN··· RB.1····· 'Led pin anode connection

    LEDon· CON·· 1····· 'high state




    IF RA.0 = LEDon· THEN
    · IF RA.1 = LEDon THEN
    ·· IF RA.2 = LEDon THEN

    HIGH LCD_Power
    ELSE
    ·· ENDIF
    · ENDIF
    ENDIF


    If i set RA.0, RA.1, RA.2 LOW RB.1·goes· LOW, but when there is no connection RB.1 stays HIGH, ·how can i make it·stay LOW and only go HIGH when the input is HIGH? i guess what i want is a logic state low, no connection, and high.

    When i·change· LCD_Power· to be LOW in the program RB.1 stays HIGH still.



    Also im trying to have LCD_Power stay on for a second then turn off and remain off·i cannot for the life of me figure out how to do that.

    Post Edited (infinkc) : 2/11/2007 1:25:11 AM GMT
  • Clock LoopClock Loop Posts: 2,069
    edited 2007-02-11 03:56
    If you want more help, I suggest you post your schematic, and full code (unless that is your full code)

    Its hard to tell what is going on with out some idea of how your hooking the sx up.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Meh. Nothing here, move along.
  • infinkcinfinkc Posts: 9
    edited 2007-02-12 14:49
    BPM said...
    If you want more help, I suggest you post your schematic, and full code (unless that is your full code)

    Its hard to tell what is going on with out some idea of how your hooking the sx up.

    that is the full code that i have so far.

    This is what im trying to do:

    -i have 3 momentary push buttons normally open connected to +5 so they go HIGH when pressed.
    -inputting the 3 into RA.0, RA.1, RA.3

    -1 momentary push botton normally open connected to GND so it gos LOW when pressed.
    -inputting the 1 into RA.4

    -RB.1 is my output. to an LED

    I want the LED(RB.1) to go HIGH when any of the first 3 button are pressed, and if RA.4 is pressed i want RB.1 to go HIGH for ~3 seconds and turn off.
  • JonnyMacJonnyMac Posts: 8,941
    edited 2007-02-12 15:41
    When one of the first three buttons are pressed, does the LED just stay on with the button, or does it stay on until button 4 is pressed and the timed event takes place?

    Also, you can simplify things by keeping all your buttons the same. Make all of them connect to ground (active-low), and then enable the onboard pull-ups to keep the inputs in the "off" state until a button is pressed. You can make active-low buttons look active-high with code.

    (Updated program posted below)

    Post Edited (JonnyMac) : 2/12/2007 9:23:58 PM GMT
  • infinkcinfinkc Posts: 9
    edited 2007-02-12 16:34
    JonnyMac said...
    When one of the first three buttons are pressed, does the LED just stay on with the button, or does it stay on until button 4 is pressed and the timed event takes place?



    When one of the first three are pressed the LED stays on as long as the button is held.

    Also, you can simplify things by keeping all your buttons the same. Make all of them connect to ground (active-low), and then enable the onboard pull-ups to keep the inputs in the "off" state until a button is pressed. You can make active-low buttons look active-high with code.

    Im using an existing circuit that i have so i cant change the inputs.

    Thanks!
    ·
  • JonnyMacJonnyMac Posts: 8,941
    edited 2007-02-12 21:22
    Okay, you'll have to put pull-downs on RA.0, RA.1, and RA.2, and a pull-up on RA.3 -- you can't just let your pins float. The SX has built-in pull-ups so you can activate that internally (just on RA.3) and use 10K pull-downs on the other bits. I modified my demo program to match your hardware.
  • infinkcinfinkc Posts: 9
    edited 2007-02-13 00:20
    JonnyMac thank you so much, everyone else thanks also for the help.
Sign In or Register to comment.