In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: In SX/B the you must preset the clock line for SHIFTIN and SHIFTOUT as those routines simply invert it. Also, you're adding the two result bytes together so you can never get anything beyond 255, and with all the division you do after I'm surprised you get anything but zero. Let me suggest you update your code like this: Dio PIN RC.4 INPUT Clk PIN RC.3 OUTPUT CS PIN RC.2 OUTPUT result VAR Word thC VAR Word ' ============= PROGRAM Start ' ============= Start: CS = 1 Main: PAUSE 1 Clk = 0 CS = 0 SHIFTIN Dio, Clk, MSBPOST, result_MSB SHIFTIN Dio, Clk, MSBPOST, result_LSB CS = 1 thC = result >> 3 thC = thC */ 640 thC = thC / 10 'BREAK GOTO Main The data sheet suggests reading a bit after the falling edge of the clock, hence MSBPOST. Note that when you declare a word in SX/B that it creates to byte aliases for the _LSB and _MSB and that's what are used in the SHIFTIN calls. Once you get this working you can modify the SHIFTIN with the speed multiplier to increase the transmission speed. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=199715#m199756 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)