Posted: 06:52am 14 Jan 2015 |
Copy link to clipboard |
 Print this post |
|
Hi All;
I've been experimenting with IEEE485/RS485 interfaces between a pair of uMiteIIs on a plugboard.
1. Using EXAR SP485E interface chips. These seem to be working fine.
2. Using COM1:
3. /DE is inverted to DE using a 2N7000 MOSFET.
4. /RE is grounded, (Although I have also tried connecting /RE to DE).
I'm not a "Software guy", pretty good at hardware though.
My "test goal" is to have each uMiteII read 2 i2c RTC clocks and compare them. The clock stuff works perfectly.
I'm now just attempting to just send and catch individual characters.
The master program just spits out 1 character every second.
'RS485ClockMaster1.bas
Start:
option autorun on
cpu 40
'OPEN "COMn: baud, buf, int, intlevel, DE, 9BIT, INV, OC, S2"
open "com1: 300,DE" AS #1
setpin 6, DOUT
Again:
PRINT #1, CHR$(65);
pin(6)=1:pause 500:pin(6)=0:pause 500
GoTo Again
The slave program should catch each character and send them to the console.
'RS485ClockSlave1.bas
Start:
option AUTORUN on
cpu 40
'OPEN "COMn: baud, buf, int, intlevel, DE, 9BIT, INV, OC, S2
open "COM1: 300, DE" AS #1
setpin 6, DOUT
Again:
IF LOC(1) >= 1 THEN ' check that we have at least one byte
pin(6)=1
A$ = INPUT$(1,1)
' Send the character to the console
print "<Lenth of A$=";len(A$);"><ASCII Code of A$=";ASC(A$);"><A$=";chr$(34);A$;chr$(34);">"
ENDIF
pin(6)=0
GoTo Again
However, it only sends this once and gets stuck.
> RUN
<Lenth of A$= 1><ASCII Code of A$= 0><A$="
This happens only once after the code is flashed.
I get nothing after a reset or a "RUN" command, it's just stuck.
Are there any "Running" code examples?
Something I can use to at least get things running?
The example in the manual is just a code snippet.
redrok
|