Shop OBEX P1 Docs P2 Docs Learn Events
Aerocomm 4790 transmission help — Parallax Forums

Aerocomm 4790 transmission help

icydashicydash Posts: 1
edited 2008-02-25 23:42 in Learn with BlocklyProp
Hey guys! I've been trying to use an aerocomm 4790 to transmit data from a microcontroller and have kind of come to a roadblock. I have used the software that comes with the aerocomm units to configure them (57600 baud rate for all baud rate options) and have successfully sent data from one computer across the room to another computer (so I'm pretty sure they're configured correctly). The next step is to write C code for my atmel ATMEGA168 to send data out serially (RS232) to the aerocomm unit and have the unit transmit that data. I have written/borrowed the following code:

/*
··· 5-10-07
··· Copyright Spark Fun Electronics© 2007
··· Nathan Seidle
··· nathan at sparkfun.com
···
··· Example basic printf input/output
*/
#include <stdio.h>
#include <avr/io.h>
#define FOSC 8000000
#define BAUD 57600
#define MYUBRR FOSC/16/BAUD-1
#define sbi(var, mask)·· ((var) |= (uint8_t)(1 << mask))
#define cbi(var, mask)·· ((var) &= (uint8_t)~(1 << mask))
#define STATUS_LED 0
//Define functions
//======================
void ioinit(void);····· // initializes IO
static int uart_putchar(char c, FILE *stream);
uint8_t uart_getchar(void);
static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
void delay_ms(uint16_t x); // general purpose delay
//======================
int main (void)
{
·uint8_t x = 0;

··· ioinit(); //Setup IO pins and defaults
··· while(1)
··· {
··x++;

··printf("Test it! x = %d", x);

··sbi(PORTC, STATUS_LED);
··delay_ms(200);
··cbi(PORTC, STATUS_LED);
··delay_ms(200);
··· }
··
··· return(0);
}
void ioinit (void)
{
··· //1 = output, 0 = input
··· DDRB = 0b11101111; //PB4 = MISO
··· DDRC = 0b11111111; //
··· DDRD = 0b11111110; //PORTD (RX on PD0)
··· //USART Baud rate: 57600
··· UBRR0H = MYUBRR >> 8;
··· UBRR0L = MYUBRR;
··· UCSR0B = (1<<RXEN0)|(1<<TXEN0);
···
··· stdout = &mystdout; //Required for printf init
}
static int uart_putchar(char c, FILE *stream)
{
··· if (c == '\n') uart_putchar('\r', stream);
·
··· loop_until_bit_is_set(UCSR0A, UDRE0);
··· UDR0 = c;
···
··· return 0;
}
uint8_t uart_getchar(void)
{
··· while( !(UCSR0A & (1<<RXC0)) );
··· return(UDR0);
}
//General short delays
void delay_ms(uint16_t x)
{
· uint8_t y, z;
· for ( ; x > 0 ; x--){
··· for ( y = 0 ; y < 80 ; y++){
····· for ( z = 0 ; z < 40 ; z++){
······· asm volatile ("nop");
····· }
··· }
· }
}

Note the code also turns on and off an LED (PORT C)·but this doesn't really have anything to do with the project....but it does work.

When I compile this code and put it on the ATMEGA168, then connect the data serial port from the development board to a computer, open hyperterminal (COM1) and run it, I can successfully see the data comming in from the microcontroller. So I'm pretty sure that I'm correctly sending data out serially from the microcontroller.

Now I'm trying to put the pieces together. When I connect the data serial port from the microcontroller development board to the serial port for the aerocomm development board and turn on the microcontroller, hoping it will send the data to the aercomm unit and that the data will be broadcasted, it doesn't work. The receiving transmitters' LINK light doesn't even go on so I'm pretty sure the sending aerocomm unit isn't even trying to send the data. My initial thought is obviously I have to put something around the data to format it correctly, OR put the unit in some kind of "transmission mode," or both. It doesn't have a whole lot of documentation though, so any help would be really appreciated. Thanks guys.
Sign In or Register to comment.