November 24, 2024, 10:33:38 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Running a magnetic card reader with a Prop-SX

Started by Caretaker.CCI, March 24, 2008, 08:27:00 PM

Previous topic - Next topic

Caretaker.CCI

OK... I bit the bullet and have dug in my heels. It's SX/programming or bust for me. Here's the first problem I've encountered:

I downloaded the card-reader program from the Nuts and Volts column and tried to get it to run on a Prop-SX (it's all I have at the moment). I couldn't get it to work. I know that's a broad statement but I want to see if I can figure this out myself. To that extent, I have a few questions.

Does RA.0 to RA.7 correspond to P0.W through P7.W on the Prop-SX? This seems logical but I can't find a listing detailing the pin-out from the SX chip and how it's connected on the Prop-SX. If this is the case, then I should hook up the serial LCD (I only have a 2x16) up to P0 with a 3-wire servo connector. Likewise the assignments for the magnetic card reader would have me connecting the output of those pins (the card reader) to P8.W through P12.W. Here's a snippet of the code from your program that I'm looking at to help me figure this out.

CrdData         PIN     RB.0 INPUT PULLUP       ' RDT\  (pin 2)
CrdClock        PIN     RB.1 INPUT PULLUP       ' RCL\  (pin 3)
CrdMotion       PIN     RB.2 INPUT PULLUP       ' CLD\  (pin 4)
CrdDetect       PIN     RB.3 INPUT PULLUP       ' CLD1\ (pin 5)
CrdEndStop      PIN     RB.4 INPUT PULLUP       ' CLD2\ (pin 6)

I'm assuming it's safe to run the card reader with P8.R and P8.B.

I would like to test the serial LCD with the Prop-SX but I'm not good enough to write code for that yet. Do you have a bit of "demo" code that will enable to see if I can get the serial LCD working using the Prop-SX?

I can download and run the program that flashes LED's (like runway lights) using the Prop-1 trainer on the Prop-SX. Since this works I think the Prop-SX is OK and I'm downloading correctly to the Prop-SX.  I tested the serial LCD using a Prop-1 and am able to get the serial LCD to work.  I have more than one card reader so if necessary I can check another unit.

That's it for now... I have a lot of reading to do.

Greg

JonnyMac

March 25, 2008, 08:18:09 AM #1 Last Edit: March 25, 2008, 08:22:56 AM by JonnyMac
If you want to run that program on the Prop-SX you'll want to use P0..P4 as those correspond with RB.0 to RB.4.  You'll also want to pop the ULN out of the socket as the input of the ULN wants to pull the pin down -- you have a fight between the internal pull-ups and the external pull-down of the ULN.  You can power the card reader from any .R and .B pin.

I've attached a serial LCD demo (for the Parallax LCD).  Connect it to RB.7 (update the listing accordingly) -- as with any other serial device, you need to remove the ULN; with the ULN on the RB port popped out already, the program should work.
Jon McPhalen
EFX-TEK Hollywood Office

Caretaker.CCI

OK... I'm sure I'm doing something retarded (the answer is probably right in front of me) but I'm not seeing why the LCD is not working.

Here's where I'm at:
1. LCD connected to P7 on Prop-SX controller
2. ULN removed from socket
3. SW1 and SW2 set to "on" (for 19,200 Baud rate)
4. LCD demo program downloaded
5. updated the program listing to
LcdTx      PIN   RB.7         ' LCD serial connection
6. checked Baud rate (to correspond to setting on LCD)
LcdBaud      CON   "T19200"      ' or T2400, or T9600

I know it's difficult to trouble-shoot something you're not looking at but I don't know what else to check or what other information I could give to help solve this problem. I have the ability to take a digital photo if that would help.

livinlowe

is the contrast turned down on the lcd? (it is a parallax lcd, right?)
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

March 25, 2008, 11:28:34 AM #4 Last Edit: March 25, 2008, 11:31:40 AM by JonnyMac
If you're not running the Prop-SX from an SX-Key (i.e., you programmed it from an SX-Blitz) then you need to pop in a 4 MHz resonator -- the SX's on-board clock is not precise enough to run serial communications.

Update: I just connected a Parallax Serial LCD to RC.7 (updated the code an popped out the upper ULN) and it works fine; again you need a resonator in place for serial comms.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

March 25, 2008, 01:07:32 PM #5 Last Edit: March 25, 2008, 01:51:24 PM by JonnyMac
Okay, I took a quick break from work work and connected the card reader to the Prop-SX -- you'll find an updated listing attached.  I decided to use RC instead of RB (as in the original program).  To connect the card reader you'll want to:

-- remove the ULN connected to P8..P15 (upper group)
-- remove the SETUP jumpers on P12 and P15 (others can come out too)

If you have a SX-Key you can use Run from the toolbar in the SX-Key IDE.  If you're using the SX-Blitz then you need to install a 20 MHz resonator into the socket and use the Program button from the toolbar.  After the program is downloaded, press the Reset button on the Prop-SX.  I programmed mine with a Key but retested with a resonator installed just to make sure everything was hunky-dory; it is.

Be very careful with your power connections between the Prop-SX and the card reader -- I connected mine backward and thought I killed the reader; luckily, after letting it cool down for a while it came back to life (good thing I grabbed it out of the waste basket for one last try....).
Jon McPhalen
EFX-TEK Hollywood Office

Caretaker.CCI

Well, I feel better about this. I wouldn't have figured that out on my own.

The contrast on the LCD is fine, I tested it with a Prop-1 I had sitting around (Thanks Sean... I didn't think of that one). The LCD is Parallax model #27976. I've been using the SX-Blitz.

I don't have an SX-Key and the electronic store near me doesn't have any resonators so I'll have to shelve this until I can place an order.

There are no markings on the 3-pin socket where the resonator goes... is it safe to assume there's no problem with which direction the component is inserted? I'm assuming it is the socket between the DB-9 connector and the 4-pin connector for downloading the program instructions.

Sorry I can't test this right away but you guys (EFX-TEK) and Parallax are pretty fast at getting orders out so it shouldn't take too long. Thanks for helping me. I'll report back here when I have tested everything.

Greg

livinlowe

I'm pretty sure there is no direction orientation on the resonators.
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

Sean is correct: there is no specific orientation for the resonators.
Jon McPhalen
EFX-TEK Hollywood Office

Caretaker.CCI

The resonator came today and I hooked up the card reader as per instructed. It works fine.

The article Jon wrote for Nuts and Volts struck a chord with me. I agree with the concept of "playing" (as indicated in the article) for the sake of playing even when no clear objective has been established. Many of the great Mathematical Theorems were discovered because the discoverer spent time "playing".

I thought I'd share my idea for this project. I don't think Jon always gets to hear what some of the outcomes are for all of his hard work.

Years ago, I attended a Haunted House that had a maze. In that maze was a room of doors. The victims were to select a door in their attempt to escape from the (seemingly) endless labyrinth of paths. I thought I'd update that idea with the card reader. The victim would have to collect a card (found earlier in the path) and use it to open the correct door. It reminds me of the computer games I've seen where the player collects objects (to be used later) that may (or may not) help them escape their impending doom. I'm not sure if I will be able to have this feature in this years' show but it will happen some day.

OK... as I said at the beginning of this thread, now I need to roll up my sleeves and see if I can understand the code for the SX. Thanks Jon.

Greg