Monday, December 27, 2010

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..
http://sites.google.com/site/species0x2118/testboard.zip

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:

Monday, November 8, 2010

Game

The development of the level generator is almost finished. I have uploaded some screenhots of the generated levels. After programming this small demonstration- and test-application (the first three pictures) i made a very versatile class out of it and hacked it into my existing game. The game was heavily optimized too. There is only one bug left in the level generator. And after that i will add some functions for adding doors, treasures, monsters and so on. On the last screenshot you can see how the generated level looks like in the game. Now some usefull links for building your own random maps:
Enjoy! ^^




Tuesday, November 2, 2010

My game...

Because i had some free time last week, i started a small game project.
The game itself will be a mixture of "Castle of the winds" and "Diablo".
A project of my dreams. ;P
Round based Hack and slay, with tons of monsters, randomly generated maps, lots of weapons and armory...

Basic movement works, collision detection works, tile loading on two layers works, very basic map generation works.
Next on the list: a random map generator.
After that: interface tuning, adding monsters, adding weapons/armory/magic, adding sound ...

Monday, October 18, 2010

New software

Last weekend i wrote a small application for calculating truth tables based on boolean logic in C++. (/me was bored)
The software is inspired by Forth (the programming language) because it makes use of an stack and the reverse Polish notation.

The quickly written readme is currently available in German only.

This is an example for an XNOR with three inputs:
Formula:
a !not b !not c !not And And a b c And And Or a b !not c !not Or Or And
Or the simplified (optimized) version:
a !not b !not c
!not And And
a b c And And Or

Calculated truth table:
a b c Z
-------
0 0 0 1
1 0 0 0
0 1 0 0
1 1 0 0
0 0 1 0
1 0 1 0
0 1 1 0
1 1 1 1

Download:
Bool_solver.zip

Sunday, September 26, 2010

Some C helper routines...

I wrote a small application for counting the number of lines (of code) in *.c files today.
As a side effect i have now some handy functions for different applications.
Luckily i had the passion to write them.


Lets take a look at the functions:
void findFiles( char *, void (char *, char *) );
Finds all files in a given folder + subfolders and calls a user defined callback function.

const char *getFileType( char * );
Returns the file extension of a given file.

const char *right( char *, int );
Returns 'i'  chars from the right side of an string (same function as the command 'right' in VBS).

Works with PellesC 6.00.4.
I used some non standard C functions in the code. So it will not work with every compiler without modifications.

Here is the library: utils.zip


(God damn...! The layout on blogger.com is so crapy)