RE: Native Serial code on TINI
"Rob van der Ouderaa" <rouderaa-qWit8jRvyhVmR6Xm/[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
Hi Andreas,
The following snippet works on my TINI ds80c400
send_char:
CLR 099h ; TI_0 bit clear
MOV SBUF0,A ; Send one serial character byte
wait_for_char: JNB 099h, wait_for_char
CLR 099h ; TI_0 bit clear
RET
Note that SBUF0 is used, so serial port 0 is used.
If serial port 1 is used, then your in trouble with the regular dallas
board,
it uses it for single wire communication.
Kind regards,
Rob van der Ouderaa
-----Original Message-----
From: tini-admin-6tN4nzCoH/[email protected] [mailto:[email protected]]On Behalf Of
Andreas Skaar
Sent: maandag 1 maart 2004 19:05
To: [email protected]
Subject: [TINI]Native Serial code on TINI
I am doing a 3rd year project where I am trying to control a Marklin train
set. I hope to do this by using the serial port on the TINI board. I have
had some success with using the java library to send the data to the train
set. But I have run in to a timing issue and java doesnt seem to give me
enough control over the system. I need to have a break for a couple of
hundred micro seconds which I cant do in java. So I have started to
research how to do it using native code.
I have written the following program to test the serial port in native mode
$include(tini.inc)
$include(ds80c390.inc)
$include(tinimacro.inc)
$include(apiequ.inc)
Serial_Init:
clr a
ret
Native_method1:
send:
MOV sbuf1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
CALL POUT
MOV SBUF1, #0ffh
CALL POUT
MOV SBUF1, #000h
;******** Send finished *********
MOV R0, #003h ;just a test value
MOV R1, #0h
MOV R2, #0h
MOV R3, #0h
CLR A ; No errors
RET ; Exit from Program
;************** Function for waiting between sending bytes
******************
POUT: JNB TI1, POUT ; Wait here until TI bit is set
CLR TI1 ; Clear TI for next byte
RET ; Return
END
I create a serial port object in the java code to set up the serial port. I
then want to use the code above to send data bytes.
But at the moment the code seems to be sending random stuff. And if I try to
run the above code more than 2 times without restarting the TINI board the
board sends random bytes after the program has finished.
Can anyone tell me what I am doing wrong with my assembly code?
_________________________________________________________________
Tired of 56k? Get a FREE BT Broadband connection
http://www.msn.co.uk/specials/btbroadband
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini
_______________________________________________
TINI mailing list
TINI-6tN4nzCoH/[email protected]
To UNSUBSCRIBE, edit your profile, or see list archives:
http://lists.dalsemi.com/mailman/listinfo/tini