Posts

Showing posts from May, 2011

Delphi video tutorials

Delphi video tutorials http://delphi.wikia.com/wiki/Delphi_Videos

Bit manipulation

a |= 0x4; /* Set bit 2 */ b &= ˜0x4; /* Clear bit 2 */ c &= ˜(1 << 3); /* Clear bit 3 */ d ˆ= (1 << 5); /* Toggle bit 5 */ e >>= 2; /* Divide e by 4 */ f <<= 2; /* Multiplay f by power 2 of 2 = 4 */

Delay .bat script

Windows is a strange thing, especially at startup. Things are just loading and loading:) Sometimes strange things happen if a program in startup folder starts before everything is loaded. There is simple way to delay your program to start with ping command. Save bellow command to file and name give it an arbitrary name with bat extension. For example: run.bat ping -w 1000 -n 10 localhost D:\MyProgram.exe   Create link to this file in windows startup folder and your program will start after it pings itself 10 times. Bellow I also copied explanation about ping command. PING is used to test TCP/IP connectivity with another host and gives information about the length of time test data takes to be sent to the host and a reply received. Its most basic use is as follows: C:\ ping IP address or hostname Pinging 160.82.52.11 with 32 bytes of data: Reply from 160.82.52.11: bytes=32 time=10ms TTL=252 Reply from 160.82.52.11: bytes=32 time<10ms TTL=252 Reply from 160.8...

Copy array from round buffer with memcopy()

Since I started to work with embedded systems I had to start thing about pointers... A subject foreign in my previews Java development. Bellow is a small spinet of my code to copy arrays with pointers. Also the use of some Microblaze functions use are shown... void BufferMemoryCopy ( void * dest , GPS_BUFFER * buff , u16 buff_offset , u32 size ) { // Microblaze -- typedef Xuint16 u16; u16 pos = ( buff -> Tail16 + buff_offset ) & GPS_FIFO_MASK ; // Fifo mast is used in roun buffer         if ( ( pos + size ) <= GPS_FIFO_SIZE ) {         memcpy ( dest , & buff -> Buffer [ pos ] , size ) ; } else { memcpy ( dest , & buff -> Buffer [ pos ] , GPS_FIFO_SIZE - pos ) ; memcpy ( dest   + ( GPS_FIFO_SIZE - pos ) , & buff -> Buffer [ 0 ] , size - ( GPS_FIFO_SIZE - pos ) ) ;