click to enlarge:

Of course you can use the free USB driver CyUSB.sys with FreeBASIC. (I posted the USB stuff for Linux,Windows in the past)
If you will create your own USB device firmware you can download the docs and tools from Cypress
and you will get a toolchain and IDE from Keil as light/demo version for free.
(its limited you can compile only few KB on code)
I found the open source SDCC - The Small Device C Compiler on sourceforge.net.
Here are my first useless but working test. (blinking LED)
Code: Select all
#define ALLOCATE_EXTERN
#include "fx2regs.h"
#include "fx2types.h"
#include "delay.h"
void main(void) {
OED=0xff; // port D as output
for(;;) {
IOD=0x00; // all 8 pins low
delay(500);
IOD=0xff; // all 8 pins high
delay(500);
}
}
You must compile the USB device descriptors *.asm and your own firmware *.c
asm: sdas8051 -logs dscr.asm
c: sdcc -lfx2.lib -L../../lib -I../../include -mmcs51 --code-size 0x2000 --xram-loc 0x3000 -Wl"-b DSCR_AREA = 0x2000" -Wl"-b INT2JT = 0x2200" led.c dscr.rel
optinal: convert the intel hex file to a binary for upload.
sdobjcopy -I ihex -O binary led.ihx led.bix
Some details of the CY7C68013A:
8051 CPU with 48 MHz, 24 I/O lines (Port A,B,D), Timers, GPIF (hardware I/O waveform designer), 16 KB SRAM + ATMEL AT24C128 serial Flash and much more.
I'ts a USB bus powered 3.3 V device but the I/O pins are 5V tolerant.
For example you can sample Ports B,D = 16 I/O lines in a loop
and transfer chunks of the samples via USB cable to your FreeBASIC Windows/Linux/ARM application.
The result are the base of a 16 channel 24 MHz USB logic analyzer for 7$. ;-)
Or you control what ever you want with 24 I/O lines over USB.
The good old LPT port does the same but with fewer lines and much lower speed and it dies more and more.
Joshy