Tuesday, December 28, 2010

"RS-232 Testboard" - more software

Just finished some libraries and tests programs for the "RS-232 Testboard" . You can download the package here: test-software.zip
I wrote a low level UART library, a high level library, and two example programs, showing the usage of the high level library (and as a bonus they have some nice effects).
All code was tested with Linux - but it should work with DOS too. If you want to compile it under Linux, you will need the ncurses developer library for the second example program.
Hm... perhaps i will upload some videos soon.

UART toy - additional comments...

I forgot to mention, that the Linux program must be executed as root. Otherwise it will not work, because it needs low level access to the serial port.
And the program must be compiled with optimization turned on.

The correct preprocessor command for GCC under Linux is "__linux__" - with two underscores and in small letters.

All commands in the instruction set are stated as ASCII characters. The return values and the parameters are in hex.

If someone got the circuit to work with Windows XP, please inform me. ;)

Monday, December 27, 2010

UART toy - part 4

And here is a list with the instruction set plus a short list of error codes for the AVR part:


Enjoy. ^.^

UART toy - part 3

And another part (not the last one) of my UART series.
Here is a piece of code for the PC to establish a connection to the RS232 testboard and to communicate with it..

It is just an example how to interface with the board and not a complete library. The example application sets the outputs, reads in the inputs, reads the analog input and calculates the voltage on that pin. Everything with hardware handshake.
But you need the right cable for the handshake. Otherwise change the "true" in the uartSend commands to "false" and delete the handshake activation.

The software is tested under DOS with TurboC and under Ubuntu Linux with GCC. The source compiles with Open Watcom too - but the Watcom binary is not tested under DOS yet.
I changed the compiler preprocessor macros for the recognition of operating systems and compilers several times - but did not test every combination with every operatin system and every compiler. Perhaps you need to figure out the correct setup for your system (or just delete the stuff you do not need).

It took me several hours to figure out, that linux needs an activated FIFO control register. Otherwise the data transmission will fail in 99% of the cases.

Sunday, December 26, 2010

UART toy - part 2

Here is the code for the AVR as well as some pictures.
The C code: RS232_Testboard.zip
The code is public domain.
I am using Peter Fleury's AVR UART library for this project.

The first picture shows a test application, written on an 80286 with Borland TurboC that communicates with the RS232 testboard:
 The second picture shows the circuit itself:

New self made toy for UART programming

I have had very few time over the last weeks, so all hobby projects were paused in this time.
But now i have some spare time again - thx to Xmas and holidays!

The current theme in the technical engineering school i visit is "UART register programming". Sounds great, right? Just good enough for an nerd like me.
Sadly we only "program" the UART on paper... sounds sick - right? I was very unsatisfied with this fact and so i designed a small circuit arround an AVR. Now i am able to test the UART programming on the PC side. I learned much by this project.

The features of the board:
  • Serial communication using RS232, 9600 baud, 8 data bits, no parity, 1 stop bit.
  • 5 digital outputs (connected to LEDs)
  • 6 digital inputs
  • 1 analog input (8 bit ADC, Umax = 2,56 V)
  • 10 build in commands
  • hardware handshake can be activated
  • 4 free ports on the AVR

First the circuit diagram: