12-29-2016, 04:19 AM
Hi
I'm playing with NanoFlite's 2400 baud driver and trying to talk to the WiModem with it.
I'm pretty sure I must be doing someting dumb, but I cant get it respond at all.
My code is based on the examples presented here :
https://github.com/nanoflite/c64-up2400-cc65
and here :
http://modelrail.otenko.com/electronics/...to-arduino
But I've not had a lot of experience with C/CC65.
I'm not even sure is the driver is being loaded.
Am I completely misunderstanding something here ?
I'm playing with NanoFlite's 2400 baud driver and trying to talk to the WiModem with it.
I'm pretty sure I must be doing someting dumb, but I cant get it respond at all.
My code is based on the examples presented here :
https://github.com/nanoflite/c64-up2400-cc65
and here :
http://modelrail.otenko.com/electronics/...to-arduino
But I've not had a lot of experience with C/CC65.
I'm not even sure is the driver is being loaded.
Am I completely misunderstanding something here ?
Code:
#include <stdlib.h>
#include <stdio.h>
#include <c64.h>
#include <conio.h>
#include <joystick.h>
#include <serial.h>
#define DRIVERNAME "c64-up2400.ser"
static const struct ser_params serialParams = {
SER_BAUD_2400, /* Baudrate */
SER_BITS_8, /* Number of data bits */
SER_STOP_1, /* Number of stop bits */
SER_PAR_NONE, /* Parity setting */
SER_HS_NONE /* Type of handshake to use */
};
void setColor(int c) {
VIC.bordercolor = c;
VIC.bgcolor0 = c;
}
void setup() {
//char c;
VIC.bordercolor = COLOR_BLACK;
VIC.bgcolor0 = COLOR_BLACK;
clrscr();
puts("C64 serial");
// Load driver
ser_load_driver(DRIVERNAME);
// Open port
ser_open(&serialParams);
// Enable serial
ser_ioctl(1, NULL);
ser_put('A');
ser_put('T');
ser_put('I');
ser_put('\r');
ser_put('\n');
}
int main() {
char send_char;
char recieve_char;
int counter = 0;
setup();
while (counter < 100) {
ser_get(&recieve_char);
printf(&recieve_char);
counter++;
}
return EXIT_SUCCESS;
}
Code:
12/29/2016 11:00:53 AM:Chameleon Found.
12/29/2016 11:01:04 AM:Saving D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.c
12/29/2016 11:01:04 AM:Compiling. cl65 -v -t c64 -O D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.c -o D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.c.prg D:\Dev\c64\chameleon\ChamUSB\wimodem\simple
Opened include file `d:\dev\c64\cc65\include/stdlib.h'
Opened include file `d:\dev\c64\cc65\include/stdio.h'
Opened include file `d:\dev\c64\cc65\include/stddef.h'
Opened include file `d:\dev\c64\cc65\include/stdarg.h'
Opened include file `d:\dev\c64\cc65\include/c64.h'
Opened include file `d:\dev\c64\cc65\include/_vic2.h'
Opened include file `d:\dev\c64\cc65\include/_sid.h'
Opened include file `d:\dev\c64\cc65\include/_6526.h'
Opened include file `d:\dev\c64\cc65\include/conio.h'
Opened include file `d:\dev\c64\cc65\include/cbm.h'
Opened include file `d:\dev\c64\cc65\include/cbm_filetype.h'
Opened include file `d:\dev\c64\cc65\include/joystick.h'
Opened include file `d:\dev\c64\cc65\include/serial.h'
0 errors, 1 warnings
Running optimizer for function `setColor'
Running optimizer for function `setup'
Running optimizer for function `update'
Running optimizer for function `draw'
Running optimizer for function `main'
Opened output file `D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.s'
Wrote output to `D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.s'
Closed output file `D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.s'
D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.c(65): Warning: `send_char' is defined but never used
Input:
Opened `D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.c.prg'...
Dumping `LOADADDR'
Writing `LOADADDR'
Dumping `HEADER'
Writing `EXEHDR'
Dumping `MAIN'
Writing `STARTUP'
Writing `LOWCODE'
Writing `CODE'
Writing `RODATA'
Writing `DATA'
Writing `INIT'
Writing `ONCE'
12/29/2016 11:01:04 AM:Reset C64
12/29/2016 11:01:07 AM:Sending D:\Dev\c64\chameleon\ChamUSB\wimodem\simple\wimodem.c.prg (5641 bytes )
12/29/2016 11:01:08 AM:Done.