Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: BASIC Stamp question

  1. #11
    Maximum Bitrate kiltjim's Avatar
    Join Date
    Feb 2004
    Location
    PA, USA
    Posts
    805
    BasicX24!

    I have not had any personal experience with it, but I've been wanting one to replace my Stamp 2!

    It is much more powerful, but you're right they don't give you much write up. It takes practically the same programming as the Stamp.

    And if you get something working, I would gladly take a look at your source code...
    2000 Subaru OBS

    Dell P3 @ 900 Mhz
    7" Lilliput TS w/DigitalWW in-dash mount
    80GB External HD

    I am Zero Bitrate....

  2. #12
    Variable Bitrate Banderon's Avatar
    Join Date
    Sep 2003
    Location
    NJ
    Posts
    425
    Quote Originally Posted by kiltjim
    BasicX24!

    I have not had any personal experience with it, but I've been wanting one to replace my Stamp 2!

    It is much more powerful, but you're right they don't give you much write up. It takes practically the same programming as the Stamp.

    And if you get something working, I would gladly take a look at your source code...
    Yeah, I'm considering the BasicX24 as my primary choice right now. I found out the Stamp 2p doesn't let you store program code outside of the onboard EEPROM, and I don't know if that'll be enough space. And the BasicX24 is faster, too.

    I'm still considering the Economy Tiger though.. http://www.wilke-technology.com

    But it's a) ugly, b) not really a stamp, and c) very little documentation/user support


    Edit: The BasicX24 actually has very good documentation and a Yahoo! Support Group. I liiike..

  3. #13
    Maximum Bitrate owenjh's Avatar
    Join Date
    Nov 2003
    Location
    NC
    Posts
    604
    Hmm, Im wanting to get a programmable chip, going to research the X24, it sounds pretty good. Does any one have the Chip & programmer and have anything good / bad to say about it?
    CarComputer Status: New Car & Broken (Motherboard Fried)
    Owen JH | My Linux Blog | The Tech Fellows

  4. #14
    Variable Bitrate Banderon's Avatar
    Join Date
    Sep 2003
    Location
    NJ
    Posts
    425
    Quote Originally Posted by owenjh
    Hmm, Im wanting to get a programmable chip, going to research the X24, it sounds pretty good. Does any one have the Chip & programmer and have anything good / bad to say about it?
    You can download the documentation and code editor off of www.basicx.com and go http://basicx.com/custapps/custapps.htm to see some of the uses this chip's been put to.

    You program it in VB syntax, so that should simplify things for most people. No C/Assembler knowledge required.

  5. #15
    Low Bitrate
    Join Date
    Nov 2003
    Location
    VT
    Posts
    65
    Here's some old code I run on my BX24 Startup code. Im still working on it, so you'll obviously notice some discrepencies, and that fact that i am not a programmer!

    '
    ' BasicX-24 Chip
    ' ________________
    ' | |
    ' COM1 TX | 1 24 | V+ Regulator in 5.5-15v
    ' COM1 RX | 2 23 | GND
    ' ATN | 3 22 | Reset (Active Low)
    ' GND | 4 21 | V+ Regulator out 4.8 - 5.5v
    ' - | 5 ADC 20 | - Ign
    ' - | 6 ADC 19 | - SW1
    ' - | 7 ADC 18 | - SW2
    ' - | 8 ADC 17 | - NA
    ' - | 9 ADC 16 | - Dimmer In
    ' - | 10 ADC 15 | - LCD Brightness
    ' - | 11 ADC 14 | - LCD SSR
    ' - | 12 ADC 13 | - CPU SSR
    ' |________________|
    '
    ' LIMITS
    ' Output:
    '
    ' Input:
    '
    ' Total: < 70mA
    '
    Option Explicit


    '--------------------------------------------------------
    ' Pin definitions for the basicX chip
    '--------------------------------------------------------
    Public Const null_pin As Byte = 0 ' Null pin for serial exchange
    Public Const cpu_power_switch_pin As Byte = 7 ' CPU Switch Pin (digital out - active low)
    Public Const cpu_ssr_pin As Byte = 14 ' CPU SSR Pin (digital out)
    Public Const lcd_ssr_pin As Byte = 13 ' Amplifier/LCD SSR Pin (digital out)
    Public Const not_used As Byte = 17 ' Not used
    Public Const dimmer_in_pin As Byte = 16 ' Dimmer in (analog in)
    Public Const switch_input_2 As Byte = 19 ' Switch Input 2 (analog in)
    Public Const switch_input_1 As Byte = 18 ' Switch Input 1 (analog in)
    Public Const ignition_in_pin As Byte = 20 ' IgnitionIn (analong in)
    Public Const red_led_pin As Byte = 25 ' red led
    Public Const green_led_pin As Byte = 26 ' green led
    Public Const temperature_in_pin As Byte = 27 ' Temperature in pin (analog in)

    '--------------------------------------------------------
    ' Some global variables
    '--------------------------------------------------------
    Public current_mode As Byte ' Mode that dash switch is in
    'Public previous_mode As Byte ' mode 0 off, mode 1 on
    Public switch_mode As Byte

    Public debug_mode As Byte

    Public switch_1_status As Integer
    Public switch_2_status As Integer
    Public ignition_status As Byte
    Public ignition_value As Integer
    Public computer_status As Integer
    Public previous_state As Integer
    Public temperature_value As Integer
    Public dimmer_value As Integer


    Public Const InputBufferSize As Integer = 17 ' 8-byte buffer.
    Public Const OutputBufferSize As Integer = 20 ' 11-byte buffer.
    Public InputBuffer(1 To InputBufferSize) As Byte
    Public OutputBuffer(1 To OutputBufferSize) As Byte




    Public error_flag As Byte
    ' Error Code Explanation
    ' 91 - Switch input error (unused mode- both input high)
    ' 92
    ' 93
    ' 94
    ' 95
    ' 96
    ' 97
    ' 98
    ' 99


    '================================================= =====
    ' MAIN
    '================================================= =====

    Public Sub Main()


    ' USE DEBUG MODE FOR VERBOSE LOGS
    debug_mode = 0 ' 0 = OFF, 1 = ON

    ' Initialize serial ports and IO
    Call initialize()

    Do
    'Call find_switch_mode()
    'Call find_ignition_mode()
    'Call set_power()
    ''Call output_data()
    'Call heartbeat()
    'Call Delay(1.0)
    'Call PutStr("SHUTDOWN")

    Call Delay(10.0)
    Call PutPin(6,1)
    Call PutPin(5,0)

    Call Delay(10.0)
    Call PutPin(6,0)
    Call PutPin(5,0)


    Loop


    End Sub









    '================================================= =====
    ' CUSTOM FUNCTIONS
    '================================================= =====

    Sub initialize()
    ' Initial state of computer is off
    computer_status = 0
    ' CPU switch initially high (off)
    Call PutPin(cpu_power_switch_pin,1)


    Call OpenQueue(InputBuffer, InputBufferSize)
    Call OpenQueue(OutputBuffer, OutputBufferSize)
    Call OpenCom(1, 19200, InputBuffer, OutputBuffer)


    previous_state = 0
    End Sub
    '------------------------------------------------------

    Public Sub PutStr( _
    ByVal Tx As String)

    ' Outputs a String type to the serial port.

    Dim Length As Integer, Ch As String * 1, bCh As Byte
    Dim I As Integer

    Length = Len(Tx)

    For I = 1 To Length
    Ch = Mid(Tx, I, 1)
    bCh = Asc(Ch)
    Call PutByte(bCh)
    Next

    End Sub
    '-------------------------------------------------------------------------------

    Public Sub PutByte( _
    ByVal Value As Byte)

    ' Sends one byte of binary data to the serial port. The byte is sent
    ' directly without translating it to a string.

    Call PutQueue(OutputBuffer, Value, 1)

    End Sub

    '-------------------------------------------------------------------------------

    Sub find_switch_mode()

    switch_1_status = GetADC(switch_input_1)
    switch_2_status = GetADC(switch_input_2)

    ' sw mode 1 2 function
    '-------------------------------
    ' 91 1 1 Error mode - switch malfunction
    ' 2 0 1 On all the time
    ' 1 1 0 Off all the time
    ' 0 0 0 Auto mode

    ' On all the time & Auto mode
    If(switch_1_status < 100 ) Then
    If(switch_2_status > 500) Then
    switch_mode = 2
    'Debug.Print " On all the time"
    else
    switch_mode = 0
    'Debug.Print " Auto Mode"
    End if

    ' Off all the time
    Else
    If(switch_2_status < 100) Then
    switch_mode = 1
    'Debug.Print " Off all the time"
    else
    switch_mode = 5
    error_flag = 1
    End If
    End If

    If(debug_mode = 1) Then
    debug.print "Sw1 status: " & Cstr(switch_1_status) &" Sw2 Status: " & CStr(switch_2_status) & " Mode: "& Cstr(switch_mode)
    End if

    End Sub

    '------------------------------------------------------

    Sub find_temperature()
    temperature_value = GetADC(temperature_in_pin)
    ' Debug.Print CStr(temperature_value)
    End Sub

    '------------------------------------------------------

    Sub find_ignition_mode()
    ignition_value = GetADC(ignition_in_pin)
    If(ignition_value > 1000) Then
    ignition_status = 1
    Else
    ignition_status = 0
    End If

    If(debug_mode = 1) Then
    Debug.Print "Ignition Value: " & CStr(ignition_value)
    End if
    End Sub

    '------------------------------------------------------

    Sub set_power()

    ' sw mode 1 2 function
    '-------------------------------
    ' 91 1 1 Error mode - switch malfunction
    ' 2 0 1 On all the time
    ' 1 1 0 Off all the time
    ' 0 0 0 Auto mode

    ' Previous mode
    '---------------
    ' 0 - previously off
    ' 1 - previously on


    ' Auto Mode - SW mode 0
    If(switch_mode = 0) Then
    If(debug_mode = 1) Then
    Debug.Print "IN Auto Mode"
    End If

    ' If car is on
    If(ignition_status = 1) Then
    If(previous_state=1) Then
    ' Ignition On - Was on - leave on
    If(debug_mode = 1) Then
    Debug.Print "Is ON, Was ON ->Leave ON"
    End if
    Else
    ' Ignition On - Was off - turn on
    If(debug_mode = 1) Then
    Debug.Print "Is ON, Was OFF -> Call Startup"
    End if
    Call startup()
    End If
    Else
    If(previous_state=1) Then
    ' Ignition Off - Was on - turn off
    If(debug_mode = 1) Then
    Debug.Print "Is OFF, Was ON -> Call Shutdown"
    End If
    Call shutdown()
    Else
    ' Ignition OFF - Was off - leave off
    If(debug_mode = 1) Then
    Debug.Print "Is OFF, was OFF -> Leave OFF"
    End If
    End If
    End If


    ' On all the time - SW mode 2
    ElseIf(switch_mode = 2) Then
    If(debug_mode = 1) Then
    Debug.Print "IN Mode 2"
    Debug.Print "On all the time"
    'Debug.Print CStr(previous_state)
    End If

    If(previous_state=0) Then
    Call startup()
    ' Was off - turn on
    Else
    ' Was on - leave on
    Call PutPin(lcd_ssr_pin,1)
    End If


    ' Off all the time - SW mode 1
    Else

    If(debug_mode = 1) Then
    Debug.Print "IN Mode 1"
    Debug.Print "Off all the time"
    'Debug.Print CStr(previous_state)
    End if

    If(previous_state=1) Then
    ' Was on - turn off
    Call shutdown()
    Else
    ' Was off - leave off
    End If
    End If


    End Sub

    '------------------------------------------------------

    Sub heartbeat()
    ' Just a little pulse to say it's alive
    Call PutPin(green_led_pin,0)
    Call Delay(1.0)
    Call PutPin(green_led_pin,1)
    Call Delay(1.0)
    End Sub


    '------------------------------------------------------

    Sub output_data()
    ' Send helpful information to the computer

    If(debug_mode = 1) Then
    Debug.Print "MODE=" & CStr(switch_mode)
    Debug.print "SW1=" & CStr(switch_1_status)
    Debug.print "SW2=" & CStr(switch_2_status)
    Debug.print "IGN=" & CStr(ignition_value)
    'Debug.Print "shutdown"
    End If
    End Sub

    '------------------------------------------------------

    Sub startup()
    If(debug_mode = 1) Then
    Debug.Print "Entering startup mode..."
    End if
    ' Power on Inverter and PS
    Call PutPin(cpu_ssr_pin,1)
    Call delay(1.0)

    ' Toggle cpu switch pin low to start cpu
    Call PutPin(cpu_power_switch_pin,0)
    Call delay(1.0)
    Call PutPin(cpu_power_switch_pin,1)

    ' Wait for computer to start
    Call Delay(5.0)

    ' Turn on LCD/Audio Amplifier
    Call PutPin(lcd_ssr_pin,1)

    ' State is ON
    previous_state = 1
    If(debug_mode = 1) Then
    Debug.Print "Finished startup mode..."
    End If

    End Sub

    '------------------------------------------------------

    Sub shutdown()
    If(debug_mode = 1) Then
    Debug.Print "Entering shutdown mode..."
    End If

    ' Shutdown amplifier and LCD screen
    'Call PutPin(lcd_ssr_pin,0)

    ' Issue shutdown computer command via serial port
    Call PutStr("SHUTDOWN")

    ' PUTBYTE(<shutdown Byte>)
    ' Wait for computer to shut down
    Call Delay(30.0)

    ' Toggle the cpu switch to turn off computer
    Call PutPin(cpu_power_switch_pin,0)
    Call delay(0.5)
    Call PutPin(cpu_power_switch_pin,1)

    ' Power off inverter and PS
    Call PutPin(lcd_ssr_pin,0)
    Call delay(1.0)
    Call PutPin(cpu_ssr_pin,0)

    ' State is OFF
    previous_state = 0

    End Sub

  6. #16
    Variable Bitrate Banderon's Avatar
    Join Date
    Sep 2003
    Location
    NJ
    Posts
    425
    Beautiful! A perfect example of what I'm talking about. Though, what I've got in mind is a far more complex. =D

    Right now, I'm thinking of using a few cheap tiny microcontrollers for specialized functions with their own small subprograms, with a good powerful microcontroller (StampX24, I guess) to interface them with the PC and the wireless network, and to rewrite their code as needed if I choose to update them.

    So far I'm thinking of using small individual microcontrollers for:

    - Power Driver Seat
    - Power Passenger Seat
    - L/R Side Mirrors
    - Windows and Sunroof
    - Headlights and LCD brightness control
    - Servo control
    - Various I/O


    The main thing I'm lacking on the BX24/35 is I/O pins. So maybe I'll just wire it to an I/O expander via I2C.. or SPI. I dunno... haven't figured it all out yet. But at the moment, a BX24 controlling a bunch of individual microcontrollers dedicated to their specific tasks seems easiest to do.

  7. #17
    Variable Bitrate
    Join Date
    Mar 2004
    Location
    Vancouver, BC, Canada
    Posts
    429
    HVWTech has a good selection of easy to use microcontrollers.

    Check it out at: http://www.hvwtech.com/pages/products1.asp?CatID=7

    I like the Stamp Stacks they make because they provide the whole platform to run the Stamp in a nice package. Plus they give you instructions on how to override the download channel as a second COM channel. See it at: http://www.hvwtech.com/pages/product...p?ProductID=13

  8. #18
    Variable Bitrate Banderon's Avatar
    Join Date
    Sep 2003
    Location
    NJ
    Posts
    425
    Quote Originally Posted by archimense
    HVWTech has a good selection of easy to use microcontrollers.

    Check it out at: http://www.hvwtech.com/pages/products1.asp?CatID=7

    I like the Stamp Stacks they make because they provide the whole platform to run the Stamp in a nice package. Plus they give you instructions on how to override the download channel as a second COM channel. See it at: http://www.hvwtech.com/pages/product...p?ProductID=13
    You're right, they have a really nice selection there. Unfortunately, all of them only run as SPI masters, not slaves. =\

    Damn.


    Edit: I guess I can run things on the I2C bus.. less wires = better.

  9. #19
    Low Bitrate crosseye's Avatar
    Join Date
    Dec 2003
    Location
    Syracuse, NY
    Posts
    80
    Banderon,

    I remember using a couple versions of the BASIC Stamp in high school for some simple applications. Also, I have used various microcontrollers since then.... the microcontrollers are way more flexible and powerful.

    I prefer programming in assembly language for these microcontrollers rather than using a higher level language such as BASIC, VB, or C/C++. This way you have more control over the functions that the microcontroller performs.

    As for EEPROM storage.... I personally would use a Flash storage (if possible) because EEPROM is sometimes a pain in the ***, especially erasing with a UV light box.

    If you need any help with programming, soldering circuit boards, ideas, algorithms, etc, let me know! I would love to help, and anything I could do for you help me out too.

    WIth that said, I know it's a lot to ask, but can you open up a thread, website, etc to document your progress through this project (pics, diagrams, explanations)? This is something that I would like to follow. I have had interests in doing similar things with my car.

    Thanks!

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Basic Stamp Programmers
    By owenjh in forum General MP3Car Discussion
    Replies: 9
    Last Post: 04-21-2004, 06:50 PM
  2. Basic electronics question...
    By R3l0ad in forum General Hardware Discussion
    Replies: 16
    Last Post: 01-02-2004, 06:39 PM
  3. Basic Stamp to control my Car-Puter
    By amrit50 in forum Power Supplies
    Replies: 20
    Last Post: 04-06-2003, 05:52 PM
  4. Your basic newbie question here.
    By tlbuckingham in forum General Hardware Discussion
    Replies: 7
    Last Post: 09-16-2002, 01:42 AM
  5. Basic Stamp interfacing
    By gizmomkr in forum General MP3Car Discussion
    Replies: 6
    Last Post: 02-03-2001, 10:26 PM

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
  •