What am I doing wrong

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
Paul Lamar
Posts: 65
Joined: 14 May 2010, 16:01 PM

What am I doing wrong

Post by Paul Lamar »

Dim x as Integer
Dim val as byte
dim CAS as byte
Sub Main()

GetCAS:
'putpin (portpin,mode)
'0 output 0
'1 output 1
'counter resets on high

call putpin(26,1) 'port D bit 1 high as in 0,1,2,3 etc etc RPM counter reset
call putpin(26,0) 'port D bit 1 low as in 0,1,2,3 etc etc RPM counter reset
Call putpin(25,1) 'port D bit 0 high as in 0,1,2,3 etc etc RPM counter enable
do
CAS = PortBit(27)
if CAS( <> 0) then 'I get an error here!!!!
exit do
end if
loop

For x = 1 to 10
val = Register.PINB 'get the port value
debug.print val;", "; 'send the data out in comma delimted form.
next

goto GetCAS
End Sub

'I'm dumb. I need more examples in the docs

'Paul Lamar
Attachments
screen-capture-error1.JPG
(136.12 KiB) Downloaded 117 times
Paul Lamar
Posts: 65
Joined: 14 May 2010, 16:01 PM

Post by Paul Lamar »

Never mind.
I figured it out trial and error.
No paren's


BTW what does "Unexpected device response (0x43), record 2." mean?

Paul Lamar
Paul Lamar
Posts: 65
Joined: 14 May 2010, 16:01 PM

Post by Paul Lamar »

I don't know what program it is executing but it is not this one :)

Paul Lamar
Attachments
screen-capture-error2.JPG
(115.76 KiB) Downloaded 238 times
twesthoff
Posts: 247
Joined: 17 March 2006, 6:45 AM
Location: Fredericksburg, VA

Post by twesthoff »

Paul,
I am just guessing here... but if you use project/go (F5) to compile and run your program, and there are any errors in the program, it does not download the program and the previously downloaded program runs.

Try using project/compile (F7) and see if there are any errors at the bottom.

Tom W
Paul Lamar
Posts: 65
Joined: 14 May 2010, 16:01 PM

Post by Paul Lamar »

I just converted it to a project and the same thing happens.
It acts like the old program is locked into the chip.

Is there a way to downloading the binary from the chip in the IDE?

I am hanging some stuff off Don's power supply and I wonder if some noise is getting into the system.

Here is a CAS stimulator. There is a bypass cap on all the WW modules.

Paul Lamar
Attachments
7500 RPM-CAS-Stimulater.jpg
(29.56 KiB) Downloaded 127 times
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

Paul Lamar wrote:what does "Unexpected device response (0x43), record 2." mean?
It means that during the download process, the IDE received a character from the device that it wasn't expecting. In this case, the unexpected character has a hexadecimal code 0x43, i.e. a capital C. Since record 1 was evidently processed correctly, I guessing that something caused the download to abort on the device side - perhaps a spurious reset.
- Don Kinzer
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

Paul Lamar wrote:Is there a way to downloading the binary from the chip in the IDE?
No. Uploading code from the device is not supported.
- Don Kinzer
Paul Lamar
Posts: 65
Joined: 14 May 2010, 16:01 PM

Post by Paul Lamar »

Could there be a spurious lock the code so no new downloads are possible?

If so is it possible to unlock the code so I can download a new program?

Paul Lamar.
Paul Lamar
Posts: 65
Joined: 14 May 2010, 16:01 PM

Post by Paul Lamar »

Are there any pin numbers on the 1281 that should not be used for I/O?

Paul Lamar
Paul Lamar
Posts: 65
Joined: 14 May 2010, 16:01 PM

Post by Paul Lamar »

In the 1281 serial interface schematic the USB interface is not shown.
What pin numbers are used for the USB interface?

I used pin 27 for an input and the USB interface appears to be damaged.
I suspect the USB is no longer working.

Is there anyway to mount the CPU in a socket or small plug in board?
Ideally that daughter board would have the essential USB interface on it and be isolated from the rest of the I/O.

Paul Lamar
Attachments
1281-serial-interface-schematic.jpg
(31.27 KiB) Downloaded 197 times
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

Paul Lamar wrote:Could there be a spurious lock the code so no new downloads are possible?
No. The reset toggling gets the device into "command mode" (part of the bootloader) from which downloads are initiated. At that time, the application is not running and, therefore, cannot affect the process.
Paul Lamar wrote:Are there any pin numbers on the 1281 that should not be used for I/O?
Only the transmit and receive lines for COM1 cannot be used for other purposes. On the ZX-1281, COM1 uses pins 27 and 28. See the table in the ZBasic System Library Manual.
Paul Lamar wrote:Is there anyway to mount the CPU in a socket or small plug in board?
Sockets for surface mount chips are typically very expensive (hundreds of dollars). You might be able to find a "breakout" board for the mega1281 but you would then need to add the serial interface circuitry and the ZX reset circuitry.
- Don Kinzer
Post Reply