In SX Microcontrollers, SX/B Compiler and SX-Key Tool, gtslabs wrote: I ordred 4 Thumbwheel switches today, 0-9 BCD output that I plan on getting a value from 0 to 9999 from. I wrote some code to read the condition of the inputs on SX48 RB.D and RB.E I have not tested it yet but it compiles ok. I am looking for some schematics for wiring up these Thumbwheel switches. The Datasheets mainly give the truth tables and not much on other info like pullup resistors or diodes if needed. Thanks in advance [code] DEVICE SX48, OSC4MHZ FREQ 4_000_000 Thumbwheel_12 Var RD ' 8 Input pins for ones and tens places Thumbwheel_34 Var RE ' 8 Input pins for hundreds and thousands places ones Var Byte Tens Var Byte Hundreds Var Word Thousands Var Byte Total Var Word PROGRAM Start Start: Main: Ones = Thumbwheel_12 & $0F 'Get lower 4 bits of RD Tens = Thumbwheel_12 & $F0 'Get Higher 4 bits of RD Tens= Tens>>4 Tens = Tens*10 Hundreds = Thumbwheel_34 & $0F 'Get lower 4 bits of RE Hundreds = Hundreds * 100 Thousands = Thumbwheel_34 & $F0 'Get Higher 4 bits of RE Thousands= Thousands>>4 Total = Thousands*1000 Total = Total+Hundreds Total = Total+ Tens Total = Total+Ones GOTO Main [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=240318 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)