beginner need to open\read\write\close

:confused:

I was given the rabbit 3000 just days ago. I was told to program serial port E to open, read, write and close the serail port. We are going to use RS232 as an input to this port with a hex message of 42 bits in length and a unknow of how messages we will receive. If some could point me in the right direction or give me some idea where to start or look it would really help. As you can tell first time programer in dynamic c.

Try searching the Samples tree for a key function call, like serEopen(). You should find a Sample program for your Rabbit variant that uses the serial port.

I would be interested in how you solved this problem as I am programming a similar application:)

It’s all about the samples. With cygwin, you can do something like:


C:\DCRABBIT_9.52\Samples>c:\cygwin\bin\find -name "*.c" | xargs -L100 grep serEo
pen
./BL2600/RS485/Master.c:        serEopen(19200);        // Set baud rate first
./BL2600/RS485/Slave.c: serEopen(19200);                // Set baud rate first
./PowerCoreFLEX/RS232/Parity.c: serEopen(baud_rate);
./PowerCoreFLEX/RS232/Simple3wire.c:    serEopen(BAUD232);
./PowerCoreFLEX/RS232/Simple5wire.c:    serEopen(BAUD232);
./PowerCoreFLEX/TCPIP/Telnet.c: #define serXopen        serEopen
./RabbitFLEX_SBC40/rs232/Simple3wire.c: #define serXopen serEopen
./tcpip/rabbitweb/ethernet_to_serial.c:         e2s_state[i].open = serEopen;

Any of the above files should have serial port code that works across Rabbit platforms.

Good luck,
Larry

Thanks Larry

I will check out thos programs
I was hoping I could find someone who has written programs for transferring data back and forth from a PC running Visual Basic but it looks like I will have to sift through those samples and develop the C and VB code myself

Chris

Larry showed the use of a cygwin grep function to help find usage of a given function in sample program files. Dynamic C has a built in GREP function that does the same thing. The GREP function is covered in section 14.1, page 242 of the DC manual for 2000/3000 processors. It is covered in section 16.1, page 235 of the DC manual for 4000+ processors. It is on the menu under Edit/Find in Files (Grep) or can be accessed by Shift+Ctrl+F.

By choosing ‘Search in directories’, then setting the File Mask (in this case C:\DCRABBIT_9.52*.c) and checking the ‘Include subdirectories’ box you would get all sample usage of the function in the ‘Text to Find’ field. You can also state multiple wildcards such as C:\DCRABBIT_9.52*.c;.h;.lib which would find all C files, header files and library files that referenced the search text. Another advantage is that the search list is ‘active’, meaning you can click on an entry of the returned search list and DC will open the file and position to the indicated line. This is a great way to explore how things get used, not only in samples, but within library files.