I am trying to build and understand Antonios Chorevas' "Low-Cost Logic Analyzer" (http://www.circuitcellar.com/AVR...)
I've attached the WinXP software ("terminal") which is meant to communicate with the AVR. I had to upgrade the code from VB to a .NET project, using Microsoft Visual Basic 2005. Executable found in bin/ directory.
The whole thing is now set up on my proto board, but I can't seem to get the "Comm with PC" part working (WinXP software attached). In the schematics (see Word document, in ZIP file at "Entry" link), the parallel port is described to connect as follows:
PIN# PIN name AVR 2 D0 PB0 3 D1 PB1 6 D4 PB5 (SCK) 7 D5 PB3 (MOSI) 9 D7 PC6 (RESET) 10 ACK PB4 (MISO) 11 Busy PB2
My parallel port is on an "extended IO bus"; a big clunk of hardware, which I can stick my laptop onto, giving me all sorts of ports.
I have a old printer cable, which I cut of the female connector. Using a multimeter, I found which wires map to which pins using the continuity test. As mentioned, it won't communicate with the PC; I've figured out that the AVR never gets past the "sync with pc"-part of the assembly code provided by Mr. Chorevas. I'm wondering if my parallel port could be differently mapped out, than the one he's got...
First, I have to disconnect the D7 connection (reset), because it simply keeps the AVR reset constantly. This is a first indication that something is "up" with my parallel port...
Next, the "sync with pc" part of the code waits for "CLK and START to go low" (see code fragment below). I can't figure out which specific pins these labels refer to, but, judging from the bitmasking
I expect this must be PB0 and PB1; namely, pins D0 and D1. And, by touching the corresponding pins on the AVR to ground, I do manage to pass through the initial sync process. By adding "debug code" (toggling LED's at particular points in the code), I verify that I actually get to the point in the code with the comment ";communicate with the PC".
The point is, I can't seem to get the PC to do this "handshaking" on it's own. And my question (finally) is; what can I do to get this working? It's not so much that I need this particular circuit, it's more that I really want to learn this stuff, and have been really struggling with this over the weekend.
For instance, I have a "parallel port monitor" software tool, which shows me which pins the PC software sets on the port. Also, it's supposed to let me set particular bits high and low. Still, the AVR does not respond when I toggle bits D0 and D1 low.
Do I need to remap the parallel port connections?
Btw, here's the info from my Device Manager:
- ECP Printer Port (LPT1)
Device type: Ports (COM & LPT)
Location: on Extended IO Bus
I/O Range 0378-037F and 0778-077A
Port settings: Never use an interrupt
Device usage: Use this device (enable)
Hope someone feels like lending a hand :)
Code Fragment borrowed from http://www.circuitcellar.com/AVR...
sl5: ;turn-on led CBI PORTC,doneled ;connect with the PC ;initial state: START=high, CLK=high ;wait till both START and CLK goes low / wait for 4 sec ;/check states again / loop if changed/turn=off led if OK con1: IN temp,PINB ANDI temp,0b00000011 BRNE con1 wait4secs IN temp,PINB ANDI temp,0b00000011 BRNE con1 SBI PORTC,doneled ;communicate with the PC ;inactive phase: START=low, CLK=low ;START goes high from the PC to begin transfer ;data changes after rising edge of CLK signal ;data is stable at the falling edge of the CLK signal ;check for inactive state IN temp,PINB BST temp,pcstart BRTC label1 ;fast blink led blinkled 30 label1: ;initialize indexes LDI Xhigh,01 LDI Xlow,00 LDI bitcounter,8 LD databyte,X+ ;wait till START goes high label2: IN temp,PINB BST temp,pcstart BRTC label2 loopt: ;wait till CLK goes high label3: IN temp,PINB BST temp,pcclk BRTC label3 ;set next bit in output MOV temp,databyte BST temp,7 BRTC label4 SBI PORTB,pcdata RJMP label5 label4: CBI PORTB,pcdata label5: ;wait till CLK goes low label6: IN temp,PINB BST temp,pcclk BRTS label6 ;advance indexes LSL databyte DEC bitcounter BRNE label7 CPI Xhigh,0x05 BREQ label8 LDI bitcounter,8 LD databyte,X+ label7: RJMP loopt label8: ;slow blink led blinkled 60 ; END OF PROGRAM