.NET sample to send teensy 3.0 syncronous/asyncronous data and get back result

Status
Not open for further replies.

WaltZie

Member
Dear all,

i'm noob with teensy, and i'm approaching to it's utilizzation.
I'd like to uderstand how to make a simple uppercase function like the following:

char* upper(char *word)
{
int i;
for (i=0;i<strlen(word);i++) word=(word>96&&word<123)?word-32:word;
return word;
}

and call it by c# (or c++ wrapper) in syncronous or asyncronous way :confused:

Thanks much

WaltZie
 
The simplest way would be to use USB Serial, where Teensy3 appears as a COM port to Windows. Every language has support for serial ports. I have not personally used C#, so I can't say exactly how to access serial ports from that language, but I'm sure you can find lots of info if you search.

On the Teensy3 side, using Arduino you would receive the string with Serial.available() and Serial.read(), storing each byte into a buffer. When you see a byte that is the end-of-string character, you'd call this code. Then you can use Serial.print() or Serial.write() to send it back to the PC.

There are other ways. RawHID offers different trade-offs. But serial is by far the most widely used and is the easiest to find examples on the web. For a trivial application like this, there's little port to using something like RawHID.
 
Thanks much :)

Is it possible to use directly Cortex-M4 ASM instructions?


; convert to uppercase:

; upper case letter do not have
; third bit set, for example:
; 'a' : 01100001b
; 'a' : 01000001b
; upper case mask : 11011111b

; clear third bit:
and byte ptr [bx], 11011111b


Thanks much

WaltZie
 
Status
Not open for further replies.
Back
Top