Menüfunktionen für die Einstellungen vervollständigt.
Dieser Commit ist enthalten in:
Ursprung
957ac1fa8d
Commit
af2821bf5f
734
Source/3
734
Source/3
@ -1,734 +0,0 @@
|
|||||||
/** \brief BJ-Keyer
|
|
||||||
|
|
||||||
:
|
|
||||||
Morsekeyer von DL7BJ
|
|
||||||
tom@dl7bj.de
|
|
||||||
|
|
||||||
OLED functions from https://github.com/Sylaina/oled-display
|
|
||||||
|
|
||||||
@verbatim
|
|
||||||
History
|
|
||||||
--------------------------------------------------------------------------
|
|
||||||
2012-05-24 DL7BJ erste Version
|
|
||||||
2013-05-10 DL7BJ Generierung des Mithörtons als Sinus mit PWM/DDS
|
|
||||||
2013-07-15 DL7BJ Änderungen der Keyerfunktionen
|
|
||||||
2013-07-19 DL7BJ Beep/Boop (Spielkram)
|
|
||||||
2013-10-20 DL7BJ Änderungen der PWM Funktionen für besseren Sinus
|
|
||||||
2022-04-10 DL7BJ erste Leiterplatten für Prototyp (bisher Lochraster)
|
|
||||||
2022-09-02 DL7BJ viele Softwareänderungen, neuer Filter für PWM
|
|
||||||
2022-09-11 DL7BJ Encoder, LC-Display, Frontplatine "entsorgt"
|
|
||||||
2023-06-28 DL7BJ Port Anpassungen an neue Leiterplatte V1.01
|
|
||||||
|
|
||||||
ATMEGA328(P)
|
|
||||||
----------
|
|
||||||
(PCINT14/_RESET) PC6 -| 1 28|- PC5 (ADC5/SCL/PCINT13)
|
|
||||||
(PCINT16/RXD) PD0 -| 2 27|- PC4 (ADC4/SDA/PCINT12)
|
|
||||||
(PCINT17/TXT) PD1 -| 3 26|- PC3 (ADC3/PCINT11)
|
|
||||||
(PCINT18/INT0) PD2 -| 4 25|- PC2 (ADC2/PCINT10)
|
|
||||||
(PCINT19/OC2B/INT1) PD3 -| 5 24|- PC1 (ADC1/PCINT9)
|
|
||||||
(PCINT20/XCK/T0) PD4 -| 6 23|- PC0 (ADC0/PCINT8)
|
|
||||||
VCC -| 7 22|- GND
|
|
||||||
GND -| 8 21|- AREF
|
|
||||||
(PCINT6/XTAL1/TOSC1) PB6 -| 9 20|- AVCC
|
|
||||||
(PCINT7/XTAL2/TOSC2) PB7 -|10 19|- PB5 (SCK/PCINT5)
|
|
||||||
(PCINT21/OC0B/T1) PD5 -|11 18|- PB4 (MISO/PCINT4)
|
|
||||||
(PCINT22/OC0A/AIN0) PD6 -|12 17|- PB3 (MOSI/OC2A/PCINT3)
|
|
||||||
(PCINT23/AIN1) PD7 -|13 16|- PB2 (SS/OC1B/PCINT2)
|
|
||||||
(PCINT0/CLK0/ICP1) PB0 -|14 15|- PB1 (OC1A/PCINT1)
|
|
||||||
----------
|
|
||||||
|
|
||||||
Pin 1 - PC6 - Reset Pin 28 - PC5 - SCL Display
|
|
||||||
Pin 2 - PD0 - RxD Pin 27 - PC4 - SDA Display
|
|
||||||
Pin 3 - PD1 - TxD Pin 26 - PC3 - LED Key
|
|
||||||
Pin 4 - PD2 - Left Paddle Pin 25 - PC2 - TRX 2 Out
|
|
||||||
Pin 5 - PD3 - Right Paddle Pin 24 - PC1 - TRX 1 Out
|
|
||||||
Pin 6 - PD4 - Straight Key Pin 23 - PC0 - Mem 4
|
|
||||||
Pin 19 - PB5 - Mem 5
|
|
||||||
Pin 11 - PD5 - Mem 1 Pin 18 - PB4 - _Audio SD
|
|
||||||
Pin 12 - PD6 - Mem 2 Pin 17 - OC2A - Audio PWM output
|
|
||||||
Pin 13 - PD7 - Mem 3 Pin 16 - PB2 - Encoder Switch
|
|
||||||
Pin 14 - PB0 - Encoder A Pin 15 - PB1 - Encoder B
|
|
||||||
|
|
||||||
|
|
||||||
Value 1 2 4 8 32 64 128 255
|
|
||||||
Bit 1 2 3 4 5 6 7 8
|
|
||||||
Pin 0 1 2 3 4 5 6 7
|
|
||||||
@endverbatim
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "bj-keyer.h"
|
|
||||||
// Additional files
|
|
||||||
#include "functions.c"
|
|
||||||
|
|
||||||
#define LENGTH 256
|
|
||||||
#define AMP 127
|
|
||||||
#define OFFSET 128
|
|
||||||
#define PI2 6.283185
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Initialsieren der Timer
|
|
||||||
*
|
|
||||||
* Alle Parameter der Timer basieren auf 16MHz Systemtakt.
|
|
||||||
*
|
|
||||||
* Timer 0 - 8 Bit timer für 1ms
|
|
||||||
* Timer 2 - 8 Bit timer für PWM zur Erzeugung des Sinustons
|
|
||||||
* Timer 1A - 16 Bit timer zur Erzeugung der Hüllkurve
|
|
||||||
* Timer 1B - 16 Bit timer wird nicht benutzt
|
|
||||||
*
|
|
||||||
* T - dot duration
|
|
||||||
* wpm - Words per Minute based on PARIS
|
|
||||||
* Formula T = 1200 / wpm
|
|
||||||
* Minimum speed 10 wpm - dot duration 120ms
|
|
||||||
* Maximum speed 99 wpm - dot duration 12ms
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void InitTimer(void)
|
|
||||||
{
|
|
||||||
cli();
|
|
||||||
// Timer 2 PWM
|
|
||||||
TCCR2A = 0;
|
|
||||||
TCCR2B = 0;
|
|
||||||
// No prescaling
|
|
||||||
sbi(TCCR2B,CS20);
|
|
||||||
// Clear OC2A on compare match
|
|
||||||
sbi(TCCR2A,COM2A1);
|
|
||||||
// Fast PWM Mode
|
|
||||||
sbi(TCCR2A,WGM20);
|
|
||||||
sbi(TCCR2A,WGM21);
|
|
||||||
// Phase Correct PWM
|
|
||||||
//sbi(TCCR2A,WGM22);
|
|
||||||
//sbi(TCCR2A,WGM20);
|
|
||||||
// Initial value
|
|
||||||
OCR2A = 0x80;
|
|
||||||
sbi(DDRB,PB3);
|
|
||||||
|
|
||||||
// Timer 1 für die Sinus Hüllkurve
|
|
||||||
TCCR1A = 0; TCCR1B = 0; TIMSK1 = 0;
|
|
||||||
// CTC Mode
|
|
||||||
sbi(TCCR1B,WGM12);
|
|
||||||
// Prescaling 8
|
|
||||||
sbi(TCCR1B,CS11);
|
|
||||||
// Output Compare Match Interrupt Enable
|
|
||||||
OCR1A = 51; // 600Hz
|
|
||||||
sbi(TIMSK1,OCIE1A);
|
|
||||||
|
|
||||||
// Timer 0 1ms für diverse Zähler
|
|
||||||
TCCR0A = 0; TCCR0B = 0; TCNT0 = 0;
|
|
||||||
cbi(TCCR0A,WGM00);
|
|
||||||
sbi(TCCR0A,WGM01);
|
|
||||||
cbi(TCCR0B,WGM02); // CTC Mode 2 Immediate
|
|
||||||
cbi(TCCR0B,CS02);
|
|
||||||
sbi(TCCR0B,CS01);
|
|
||||||
sbi(TCCR0B,CS00); // prescaler 64
|
|
||||||
OCR0A = 249; // CTC 1ms
|
|
||||||
sbi(TIMSK0,OCIE0A); // Enable Timer 0 CTC
|
|
||||||
sei();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Init()
|
|
||||||
{
|
|
||||||
cli(); // disable all interrupts
|
|
||||||
|
|
||||||
MachineMode = NORMAL;
|
|
||||||
SendStatus = SENDING_NOTHING;
|
|
||||||
|
|
||||||
// PORTB
|
|
||||||
DDRB = 0x00;
|
|
||||||
// Interne PullUps einschalten
|
|
||||||
sbi(PORTB,PB0);
|
|
||||||
sbi(PORTB,PB1);
|
|
||||||
sbi(PORTB,PB2);
|
|
||||||
sbi(PORTB,PB3);
|
|
||||||
sbi(PORTB,PB5);
|
|
||||||
sbi(PORTB,AUDIO_EN);
|
|
||||||
// Ein- und Ausgänge festlegen
|
|
||||||
sbi(DDRB,PB3); // PWM
|
|
||||||
sbi(DDRB,AUDIO_EN);
|
|
||||||
// Audio Verstärker abschalten
|
|
||||||
// cbi(PORTB,AUDIO_EN);
|
|
||||||
|
|
||||||
// PORTC
|
|
||||||
sbi(DDRC,MORSE_LED);
|
|
||||||
|
|
||||||
// PORTD
|
|
||||||
// Ein- und Ausgänge festlegen
|
|
||||||
DDRD = 0x00;
|
|
||||||
// Interne PullUps für die Eingänge abschalten
|
|
||||||
cbi(PORTD,LEFT_PADDLE);
|
|
||||||
cbi(PORTD,RIGHT_PADDLE);
|
|
||||||
cbi(PORTD,STRAIGHT_KEY);
|
|
||||||
|
|
||||||
t_element_length = (uint16_t)1200/bConfig.wpm;
|
|
||||||
|
|
||||||
// Pin Change Interrupts Port D - Keys
|
|
||||||
// PD4 - StraightKey - PCINT20 - Pin Change Interrupt 20
|
|
||||||
// PD3 - Right Paddle - PCINT19 - Pin Change Interrupt 19
|
|
||||||
// PD2 - Left Paddle - PCINT18 - Pin Change Interrupt 18
|
|
||||||
sbi(PCICR,PCIE2);
|
|
||||||
sbi(PCMSK2,PCINT18);
|
|
||||||
sbi(PCMSK2,PCINT19);
|
|
||||||
sbi(PCMSK2,PCINT20);
|
|
||||||
|
|
||||||
// Init serial
|
|
||||||
UBRR0=UBRR_VALUE; // Set baud rate
|
|
||||||
sbi(UCSR0B,TXEN0); // Enable TX
|
|
||||||
sbi(UCSR0B,RXEN0); // Enable RX
|
|
||||||
sbi(UCSR0B,RXCIE0); // RX complete interrupt
|
|
||||||
sbi(UCSR0C,UCSZ01); // no parity, 1 stop bit
|
|
||||||
sbi(UCSR0C,UCSZ01); // 8-bit data
|
|
||||||
|
|
||||||
InitTimer();
|
|
||||||
EncoderInit();
|
|
||||||
|
|
||||||
// Initialisierung Menüvariablen
|
|
||||||
bMenuCtrl.ClrScr = 1;
|
|
||||||
bMenuCtrl.Update = 1;
|
|
||||||
bMenuCtrl.Config = 0;
|
|
||||||
bMenuCtrl.buttonPressed = 0;
|
|
||||||
bMenuCtrl.WriteEEProm = 0;
|
|
||||||
bMenuCtrl.buttonPressedLong = 0;
|
|
||||||
// Initialisierung Konfiguration
|
|
||||||
bConfig.iambic = 1;
|
|
||||||
bConfig.sidetone_f = 600;
|
|
||||||
bConfig.sidetone = 1;
|
|
||||||
bConfig.trx = 0;
|
|
||||||
bConfig.weight = 50;
|
|
||||||
bConfig.wpmbpm = 1;
|
|
||||||
bConfig.wpm = 15;
|
|
||||||
bConfig.ratio = 30;
|
|
||||||
bConfig.reverse = 0;
|
|
||||||
bConfig.SinusRising = 6;
|
|
||||||
sei(); // enable all interrupts
|
|
||||||
}
|
|
||||||
/** \brief 16 Bit Timer 1A
|
|
||||||
*
|
|
||||||
* Timer 1A interrupt
|
|
||||||
* Overflow interrupt every 64µs
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//ISR(TIMER1_OVF_vect)
|
|
||||||
//{
|
|
||||||
// //sCurrentTimer += 0xffff;
|
|
||||||
// PORTD ^= (1<<PD1);
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
ISR(TIMER1_COMPA_vect)
|
|
||||||
{
|
|
||||||
IntDisable();
|
|
||||||
if(StateRising > 0)
|
|
||||||
{
|
|
||||||
OCR2A = (pgm_read_byte_near(sinewave+icnt) >> StateRising);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OCR2A = pgm_read_byte_near(sinewave+icnt);
|
|
||||||
}
|
|
||||||
icnt++;
|
|
||||||
if(icnt > SINEWAVELENGTH - 1)
|
|
||||||
{
|
|
||||||
icnt = 0;
|
|
||||||
if(StateRising > 0)
|
|
||||||
StateRising--;
|
|
||||||
}
|
|
||||||
IntEnable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief 8 Bit Timer 0
|
|
||||||
*
|
|
||||||
* The Timer 0 CTC interrupt
|
|
||||||
* Dieser Interrupt wird jede Millisekunde erzeugt
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
ISR(TIMER0_COMPA_vect)
|
|
||||||
{
|
|
||||||
ms++;
|
|
||||||
StoreEEprom++;
|
|
||||||
MenuCtrlTimer++;
|
|
||||||
|
|
||||||
mselement++; // element length of dit or dat
|
|
||||||
|
|
||||||
t_wait++;
|
|
||||||
l_timer++;
|
|
||||||
encoder_timer++;
|
|
||||||
|
|
||||||
if(l_timer >= L_WAIT){
|
|
||||||
l_timer = 0;
|
|
||||||
}
|
|
||||||
// Alle 5ms den Drehencoder abfragen
|
|
||||||
if(encoder_timer > 5) {
|
|
||||||
EncoderPolling();
|
|
||||||
// Schalter vom Drehencoder abfragen
|
|
||||||
if(EncoderGetButtonState() == ButtonPressed_Short)
|
|
||||||
{
|
|
||||||
bMenuCtrl.buttonPressed = 1;
|
|
||||||
SendSerialString("Button pressed short\r\n");
|
|
||||||
}
|
|
||||||
if(EncoderGetButtonState() == ButtonPressed_Long)
|
|
||||||
{
|
|
||||||
bMenuCtrl.buttonPressedLong = 1;
|
|
||||||
SendSerialString("Button pressed long\r\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Wpm verändert?
|
|
||||||
if((StoreEEprom > 1000) && (bMerker.WpMChanged))
|
|
||||||
{
|
|
||||||
StoreEEprom = 0;
|
|
||||||
bMerker.WriteWpMEEProm = 1;
|
|
||||||
bMerker.WpMChanged = 0;
|
|
||||||
}
|
|
||||||
// Konfiguration nach 3 Sekunden verlassen
|
|
||||||
// if((MenuCtrlTimer > 3000) && (bMenuCtrl.Config == 1))
|
|
||||||
// {
|
|
||||||
// bMenuCtrl.Config = 0;
|
|
||||||
// bMenuCtrl.Update = 1;
|
|
||||||
// bMenuCtrl.ClrScr = 1;
|
|
||||||
// BeepBoop();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief 8 Bit Timer 2
|
|
||||||
*
|
|
||||||
* Timer 2 overflow interrupt
|
|
||||||
* Mit diesem Interrupt wird der nächste Wert für die
|
|
||||||
* Erzeugung des Sinus für den Mithörton geladen.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
ISR(TIMER2_OVF_vect)
|
|
||||||
{
|
|
||||||
// phaccu = phaccu + tword_m;
|
|
||||||
// icnt = phaccu >> 24;
|
|
||||||
// OCR2A = pgm_read_byte_near(sinewave+icnt);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief Pin Change Interupts für Paddle und StraightKey
|
|
||||||
*
|
|
||||||
* Pin Change Interrupt Vector für die Tasteneingänge
|
|
||||||
* Str Pa2 Pa1
|
|
||||||
* PORTD PD7 PD6 PD5 PD4 PD3 PD2 PD1 PD0
|
|
||||||
* x80 x40 x20 x10 x8 x4 x2 x1
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
ISR(PCINT2_vect)
|
|
||||||
{
|
|
||||||
uint8_t changedbits;
|
|
||||||
changedbits = PIND ^ keyhistory;
|
|
||||||
keyhistory = PIND;
|
|
||||||
|
|
||||||
if(changedbits & (1<<STRAIGHT_KEY))
|
|
||||||
{
|
|
||||||
if(PIND & (1<<STRAIGHT_KEY))
|
|
||||||
{
|
|
||||||
PORTC &= ~(1<<MORSE_LED);
|
|
||||||
SideToneOff();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PORTC |= (1<<MORSE_LED);
|
|
||||||
SideToneOn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ISR(USART_RX_vect)
|
|
||||||
{
|
|
||||||
unsigned char data;
|
|
||||||
data = UDR0;
|
|
||||||
SendSerialChar(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief ClearSendBuffer
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void ClearSendBuffer(void)
|
|
||||||
{
|
|
||||||
// sendbufferbytes = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** \brief CheckDitPaddle
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void CheckDitPaddle(void)
|
|
||||||
{
|
|
||||||
uint8_t pinvalue = 0;
|
|
||||||
uint8_t ditpaddle = 0;
|
|
||||||
|
|
||||||
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
|
|
||||||
ditpaddle = LEFT_PADDLE;
|
|
||||||
else
|
|
||||||
ditpaddle = RIGHT_PADDLE; // reverse paddle
|
|
||||||
|
|
||||||
pinvalue = ReadKeyPin(ditpaddle);
|
|
||||||
|
|
||||||
if(pinvalue == 0)
|
|
||||||
DitBuffer = 1;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
** CheckDahPaddle
|
|
||||||
*/
|
|
||||||
void CheckDahPaddle(void)
|
|
||||||
{
|
|
||||||
uint8_t pinvalue = 0;
|
|
||||||
uint8_t dahpaddle = 0;
|
|
||||||
|
|
||||||
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
|
|
||||||
dahpaddle = RIGHT_PADDLE;
|
|
||||||
else
|
|
||||||
dahpaddle = LEFT_PADDLE; // reverse paddle
|
|
||||||
|
|
||||||
pinvalue = ReadKeyPin(dahpaddle);
|
|
||||||
|
|
||||||
if(pinvalue == 0) {
|
|
||||||
if(DahBuffer == 0) {
|
|
||||||
DahCounter++;
|
|
||||||
DitCounter = 0;
|
|
||||||
}
|
|
||||||
DahBuffer = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
** DoMorse
|
|
||||||
*/
|
|
||||||
void DoMorse(void)
|
|
||||||
{
|
|
||||||
if((KeyerMode == IAMBIC_A) || (KeyerMode == IAMBIC_B) || KeyerMode == SINGLE_PADDLE)
|
|
||||||
{
|
|
||||||
if((KeyerMode == IAMBIC_A) && (IambicFlag) && (ReadKeyPin(LEFT_PADDLE)))
|
|
||||||
{
|
|
||||||
IambicFlag = 0;
|
|
||||||
DitBuffer = 0;
|
|
||||||
DahBuffer = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(DitBuffer)
|
|
||||||
{
|
|
||||||
DitBuffer = 0;
|
|
||||||
SendDit(MANUAL_SENDING);
|
|
||||||
}
|
|
||||||
if(DahBuffer)
|
|
||||||
{
|
|
||||||
DahBuffer = 0;
|
|
||||||
SendDah(MANUAL_SENDING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(KeyerMode == STRAIGHT)
|
|
||||||
{
|
|
||||||
if(DitBuffer)
|
|
||||||
{
|
|
||||||
DitBuffer = 0;
|
|
||||||
TXSidetoneKey(1,MANUAL_SENDING);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TXSidetoneKey(0,MANUAL_SENDING);
|
|
||||||
}
|
|
||||||
DitCounter = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigMenue(void)
|
|
||||||
{
|
|
||||||
char line[22];
|
|
||||||
|
|
||||||
lcd_charMode(NORMAL);
|
|
||||||
lcd_gotoxy(0,0);
|
|
||||||
sprintf(line,"%s - %i","Konfiguration", bMenuCtrl.CurMenue);
|
|
||||||
lcd_puts(line);
|
|
||||||
lcd_charMode(DOUBLESIZE);
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
lcd_puts(CLEARLINE);
|
|
||||||
switch(bMenuCtrl.CurMenue)
|
|
||||||
{
|
|
||||||
case M_TRX1:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if((bConfig.trx == 1) || (bConfig.trx == 0))
|
|
||||||
sprintf(line,"[%s]", "TRX 1");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s", "TRX 1");
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_TRX2:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if((bConfig.trx == 2) || (bConfig.trx == 0))
|
|
||||||
sprintf(line,"[%s]", "TRX 2");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s", "TRX 2");
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_IAMBICA:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if(bConfig.iambic == 1)
|
|
||||||
sprintf(line,"[%s]", "Iambic A");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s", "Iambic A");
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_IAMBICB:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if(bConfig.iambic == 2)
|
|
||||||
sprintf(line,"[%s]", "Iambic B");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s", "Iambic B");
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_REVERSE:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if(bConfig.reverse == 0)
|
|
||||||
sprintf(line,"%s", "L . R -");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s", "L - R .");
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_RATIO:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if(bConfig.ratio == 30)
|
|
||||||
sprintf(line,"%s", "Ratio 3:1");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s %f:1", "Ratio", bConfig.ratio/10);
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_TON_FREQ:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if(bConfig.sidetone_f == 650)
|
|
||||||
sprintf(line,"%s", "Ton 650Hz");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s %uHz", "Ton", bConfig.sidetone_f);
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_TON:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if(bConfig.ratio == 1)
|
|
||||||
sprintf(line,"%s", "Ton an");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s", "Ton aus");
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
case M_WPMBPM:
|
|
||||||
lcd_gotoxy(0,3);
|
|
||||||
if(bConfig.wpmbpm == 0)
|
|
||||||
sprintf(line,"%s", "WpM");
|
|
||||||
else
|
|
||||||
sprintf(line,"%s", "BpM");
|
|
||||||
lcd_puts(line);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
bMenuCtrl.Update = 0;
|
|
||||||
lcd_charMode(NORMAL);
|
|
||||||
}
|
|
||||||
/** \brief UpdateDisplay
|
|
||||||
*
|
|
||||||
* Aktualisierung der Anzeigen auf dem Display je nach
|
|
||||||
* aktueller Funktion.
|
|
||||||
*
|
|
||||||
* DOUBLESIZE 4x10 character
|
|
||||||
* NORMALSIZE 8x21 character
|
|
||||||
*/
|
|
||||||
void UpdateDisplay(void)
|
|
||||||
{
|
|
||||||
char line[22];
|
|
||||||
if(bMenuCtrl.Update)
|
|
||||||
{
|
|
||||||
if(bMenuCtrl.ClrScr)
|
|
||||||
{
|
|
||||||
lcd_clrscr();
|
|
||||||
bMenuCtrl.ClrScr = 0;
|
|
||||||
}
|
|
||||||
if(!(bMenuCtrl.Config))
|
|
||||||
{
|
|
||||||
lcd_charMode(DOUBLESIZE);
|
|
||||||
lcd_gotoxy(4,3);
|
|
||||||
if(bConfig.wpmbpm)
|
|
||||||
sprintf(line,"%i WpM ",bConfig.wpm);
|
|
||||||
else
|
|
||||||
sprintf(line,"%i BpM ", bConfig.wpm*5);
|
|
||||||
lcd_puts(line);
|
|
||||||
lcd_charMode(NORMAL);
|
|
||||||
lcd_gotoxy(13,0);
|
|
||||||
if(bConfig.iambic == 1)
|
|
||||||
sprintf(line,"%s", IambicA);
|
|
||||||
if(bConfig.iambic == 2)
|
|
||||||
sprintf(line,"%s", IambicB);
|
|
||||||
lcd_puts(line);
|
|
||||||
lcd_gotoxy(0,0);
|
|
||||||
if(bConfig.trx == 1)
|
|
||||||
sprintf(line, "%s", Trx1);
|
|
||||||
if(bConfig.trx == 2)
|
|
||||||
sprintf(line, "%s", Trx2);
|
|
||||||
if(bConfig.trx == 0)
|
|
||||||
sprintf(line, "%s %s", Trx1, Trx2);
|
|
||||||
lcd_puts(line);
|
|
||||||
}
|
|
||||||
if(bMenuCtrl.Config)
|
|
||||||
{
|
|
||||||
ConfigMenue();
|
|
||||||
}
|
|
||||||
bMenuCtrl.Update = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void Drehencoder(void)
|
|
||||||
{
|
|
||||||
int8_t st = 0;
|
|
||||||
static int8_t last;
|
|
||||||
|
|
||||||
if(!(bMenuCtrl.Config))
|
|
||||||
{
|
|
||||||
EncoderMinMax(5,50);
|
|
||||||
st = EncoderRead(1);
|
|
||||||
if(bConfig.wpm != st)
|
|
||||||
{
|
|
||||||
bConfig.wpm = st;
|
|
||||||
bMerker.WpMChanged = 1;
|
|
||||||
bMenuCtrl.Update = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if((bMenuCtrl.buttonPressed == 1) && (bMenuCtrl.Config == 0))
|
|
||||||
{
|
|
||||||
bMenuCtrl.Config = 1;
|
|
||||||
MenuCtrlTimer = 0;
|
|
||||||
bMenuCtrl.buttonPressed = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((bMenuCtrl.buttonPressedLong == 1) && (bMenuCtrl.Config == 1))
|
|
||||||
{
|
|
||||||
bMenuCtrl.Config = 0;
|
|
||||||
bMenuCtrl.Update = 1;
|
|
||||||
bMenuCtrl.buttonPressedLong = 0;
|
|
||||||
bMenuCtrl.buttonPressed = 0;
|
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
MenuCtrlTimer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bMenuCtrl.Config == 1)
|
|
||||||
{
|
|
||||||
if(!bMenuCtrl.buttonPressed)
|
|
||||||
{
|
|
||||||
EncoderMinMax(1,M_MAX);
|
|
||||||
st = EncoderRead(1);
|
|
||||||
sprintf(sdebug,"Encoder %i\r\n",st);
|
|
||||||
SendSerialString(sdebug);
|
|
||||||
if(last != st)
|
|
||||||
{
|
|
||||||
bMenuCtrl.CurMenue = st;
|
|
||||||
bMenuCtrl.Update = 1;
|
|
||||||
}
|
|
||||||
last = st;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bMenuCtrl.buttonPressed)
|
|
||||||
{
|
|
||||||
bMenuCtrl.m_buttonPressed = 1;
|
|
||||||
bMenuCtrl.buttonPressed = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(bMenuCtrl.m_buttonPressed == 1)
|
|
||||||
{
|
|
||||||
UpdateDisplay();
|
|
||||||
switch(bMenuCtrl.CurMenue)
|
|
||||||
{
|
|
||||||
case M_TRX1:
|
|
||||||
if(bConfig.trx == 2)
|
|
||||||
bConfig.trx = 0;
|
|
||||||
else
|
|
||||||
bConfig.trx = 1;
|
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
break;
|
|
||||||
case M_TRX2:
|
|
||||||
if(bConfig.trx == 1)
|
|
||||||
bConfig.trx = 0;
|
|
||||||
else
|
|
||||||
bConfig.trx = 2;
|
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
break;
|
|
||||||
case M_IAMBICA:
|
|
||||||
bConfig.iambic = 1;
|
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
break;
|
|
||||||
case M_IAMBICB:
|
|
||||||
bConfig.iambic = 2;
|
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
break;
|
|
||||||
case M_REVERSE:
|
|
||||||
if(bConfig.reverse == 1)
|
|
||||||
bConfig.reverse = 0;
|
|
||||||
else
|
|
||||||
bConfig.reverse = 1;
|
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
break;
|
|
||||||
case M_RATIO:
|
|
||||||
EncoderMinMax(15,30);
|
|
||||||
st = EncoderRead(1);
|
|
||||||
bConfig.ratio = st;
|
|
||||||
if(bConfig.ratio > 30) bConfig.ratio = 30;
|
|
||||||
if(bConfig.ratio < 15) bConfig.ratio = 15;
|
|
||||||
bMenuCtrl.Update = 1;
|
|
||||||
break;
|
|
||||||
case M_TON_FREQ:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** main
|
|
||||||
*/
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
Init();
|
|
||||||
SideToneOff();
|
|
||||||
|
|
||||||
lcd_init(LCD_DISP_ON);
|
|
||||||
lcd_charMode(DOUBLESIZE);
|
|
||||||
lcd_home();
|
|
||||||
lcd_puts(PRG);
|
|
||||||
lcd_gotoxy(1,2);
|
|
||||||
lcd_puts(VER);
|
|
||||||
lcd_gotoxy(2,4);
|
|
||||||
lcd_puts(CALL);
|
|
||||||
delayms(1000);
|
|
||||||
|
|
||||||
MachineMode = NORMAL;
|
|
||||||
KeyerMode = IAMBIC_A;
|
|
||||||
ReadEEProm_WpM();
|
|
||||||
|
|
||||||
SendSerialString(CLRSCR);
|
|
||||||
SendSerialString("BJ-Keyer V1.00\r\n");
|
|
||||||
SendSerialString("Ready!\r\n");
|
|
||||||
|
|
||||||
EncoderWrite(bConfig.wpm);
|
|
||||||
BeepBoop();
|
|
||||||
|
|
||||||
SetFrequency(600);
|
|
||||||
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
Drehencoder();
|
|
||||||
|
|
||||||
if(bMerker.WriteWpMEEProm)
|
|
||||||
WriteEEProm_WpM();
|
|
||||||
|
|
||||||
UpdateDisplay();
|
|
||||||
|
|
||||||
// if(MachineMode == NORMAL)
|
|
||||||
// {
|
|
||||||
// CheckPaddles();
|
|
||||||
// DoMorse();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(MachineMode == COMMAND)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
|||||||
:080000000203005802010C5537
|
:0F0000000605050C5802001E0000000101005506
|
||||||
:00000001FF
|
:00000001FF
|
||||||
|
@ -1,102 +0,0 @@
|
|||||||
\relax
|
|
||||||
\providecommand\hyper@newdestlabel[2]{}
|
|
||||||
\providecommand*\new@tpo@label[2]{}
|
|
||||||
\providecommand\babel@aux[2]{}
|
|
||||||
\@nameuse{bbl@beforestart}
|
|
||||||
\catcode `"\active
|
|
||||||
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
|
|
||||||
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
|
|
||||||
\global\let\oldcontentsline\contentsline
|
|
||||||
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
|
|
||||||
\global\let\oldnewlabel\newlabel
|
|
||||||
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
|
|
||||||
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
|
|
||||||
\AtEndDocument{\ifx\hyper@anchor\@undefined
|
|
||||||
\let\contentsline\oldcontentsline
|
|
||||||
\let\newlabel\oldnewlabel
|
|
||||||
\fi}
|
|
||||||
\fi}
|
|
||||||
\global\let\hyper@last\relax
|
|
||||||
\gdef\HyperFirstAtBeginDocument#1{#1}
|
|
||||||
\providecommand\HyField@AuxAddToFields[1]{}
|
|
||||||
\providecommand\HyField@AuxAddToCoFields[2]{}
|
|
||||||
\providecommand\BKM@entry[2]{}
|
|
||||||
\babel@aux{ngerman}{}
|
|
||||||
\BKM@entry{id=1,dest={636861707465722E31},srcline={135},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030465C303030755C3030306E5C3030306B5C303030745C303030695C3030306F5C3030306E5C303030655C3030306E}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {1}Funktionen}{5}{chapter.1}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\BKM@entry{id=2,dest={636861707465722E32},srcline={149},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030485C303030695C3030306E5C303030775C303030655C303030695C303030735C303030655C3030305C3034305C3030307A5C303030755C303030725C3030305C3034305C303030445C3030306F5C3030306B5C303030755C3030306D5C303030655C3030306E5C303030745C303030615C303030745C303030695C3030306F5C3030306E}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {2}Hinweise zur Dokumentation}{7}{chapter.2}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\BKM@entry{id=3,dest={636861707465722E33},srcline={153},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030475C303030725C303030755C3030306E5C303030645C3030306C5C303030615C303030675C303030655C3030306E}
|
|
||||||
\BKM@entry{id=4,dest={73656374696F6E2E332E31},srcline={155},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030425C303030655C303030745C303030725C303030695C303030655C303030625C303030735C303030615C303030725C303030745C303030655C3030306E5C3030305C3034305C303030655C303030695C3030306E5C303030655C303030735C3030305C3034305C3030304D5C3030306F5C303030725C303030735C303030655C3030302D5C3030304B5C303030655C303030795C303030655C303030725C30303073}
|
|
||||||
\BKM@entry{id=5,dest={73756273656374696F6E2E332E312E31},srcline={157},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C3030305A5C303030655C303030695C303030745C303030765C303030655C303030725C303030685C303030615C3030306C5C303030745C303030655C3030306E}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {3}Grundlagen}{9}{chapter.3}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{toc}{\contentsline {section}{\numberline {3.1}Betriebsarten eines Morse-Keyers}{9}{section.3.1}\protected@file@percent }
|
|
||||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1.1}Zeitverhalten}{9}{subsection.3.1.1}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\contentsline {figure}{\numberline {3.1}{\ignorespaces Diagramm Mode A\relax }}{9}{figure.caption.4}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\contentsline {figure}{\numberline {3.2}{\ignorespaces Diagramm Mode B\relax }}{9}{figure.caption.5}\protected@file@percent }
|
|
||||||
\BKM@entry{id=6,dest={636861707465722E34},srcline={212},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030425C303030655C303030645C303030695C303030655C3030306E5C303030755C3030306E5C30303067}
|
|
||||||
\BKM@entry{id=7,dest={73656374696F6E2E342E31},srcline={214},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030545C303030615C303030735C303030745C303030615C303030745C303030755C303030725C303030625C303030655C3030306C5C303030655C303030675C303030755C3030306E5C30303067}
|
|
||||||
\BKM@entry{id=8,dest={73756273656374696F6E2E342E312E31},srcline={216},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C3030305C3333345C303030625C303030655C303030725C303030735C303030695C303030635C303030685C30303074}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {4}Bedienung}{11}{chapter.4}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Tastaturbelegung}{11}{section.4.1}\protected@file@percent }
|
|
||||||
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Übersicht}{11}{subsection.4.1.1}\protected@file@percent }
|
|
||||||
\BKM@entry{id=9,dest={636861707465722E35},srcline={220},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030535C303030635C303030685C303030615C3030306C5C303030745C303030755C3030306E5C30303067}
|
|
||||||
\BKM@entry{id=10,dest={73656374696F6E2E352E31},srcline={222},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030425C303030655C303030735C303030635C303030685C303030725C303030655C303030695C303030625C303030755C3030306E5C30303067}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {5}Schaltung}{13}{chapter.5}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{toc}{\contentsline {section}{\numberline {5.1}Beschreibung}{13}{section.5.1}\protected@file@percent }
|
|
||||||
\@writefile{lot}{\contentsline {table}{\numberline {5.1}{\ignorespaces Programmierpunkte Teil 1\relax }}{13}{table.caption.6}\protected@file@percent }
|
|
||||||
\BKM@entry{id=11,dest={636861707465722E36},srcline={233},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030425C303030655C303030735C303030635C303030685C303030725C303030655C303030695C303030625C303030755C3030306E5C303030675C3030305C3034305C303030645C303030655C303030725C3030305C3034305C303030485C303030615C303030725C303030645C303030775C303030615C303030725C30303065}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {6}Beschreibung der Hardware}{15}{chapter.6}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\contentsline {table}{\numberline {6.1}{\ignorespaces Klemmenbelegung\relax }}{15}{table.caption.7}\protected@file@percent }
|
|
||||||
\BKM@entry{id=12,dest={636861707465722E37},srcline={243},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030425C303030655C303030735C303030635C303030685C303030725C303030655C303030695C303030625C303030755C3030306E5C303030675C3030305C3034305C303030645C303030655C303030725C3030305C3034305C303030535C3030306F5C303030665C303030745C303030775C303030615C303030725C30303065}
|
|
||||||
\BKM@entry{id=13,dest={73656374696F6E2E372E31},srcline={244},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030545C303030695C3030306D5C303030655C303030725C3030305C3034305C30303031}
|
|
||||||
\BKM@entry{id=14,dest={73756273656374696F6E2E372E312E31},srcline={251},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030545C303030695C3030306D5C303030655C303030725C3030305C3034305C303030655C303030695C3030306E5C303030735C303030745C303030655C3030306C5C3030306C5C303030655C3030306E}
|
|
||||||
\BKM@entry{id=15,dest={73656374696F6E2E372E32},srcline={258},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030535C303030695C3030306E5C303030755C303030735C3030305C3034305C3030304D5C303030695C303030745C303030685C3030305C3336365C303030725C303030745C3030306F5C3030306E5C3030305C3034305C303030645C303030755C303030725C303030635C303030685C3030305C3034305C303030505C303030755C3030306C5C303030735C303030775C303030655C303030695C303030745C303030655C3030306E5C3030306D5C3030306F5C303030645C303030755C3030306C5C303030615C303030745C303030695C3030306F5C3030306E}
|
|
||||||
\BKM@entry{id=16,dest={73756273656374696F6E2E372E322E31},srcline={264},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030475C303030725C303030755C3030306E5C303030645C3030306C5C303030615C303030675C303030655C3030306E}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {7}Beschreibung der Software}{17}{chapter.7}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{toc}{\contentsline {section}{\numberline {7.1}Timer 1}{17}{section.7.1}\protected@file@percent }
|
|
||||||
\@writefile{toc}{\contentsline {subsection}{\numberline {7.1.1}Timer einstellen}{17}{subsection.7.1.1}\protected@file@percent }
|
|
||||||
\@writefile{toc}{\contentsline {section}{\numberline {7.2}Sinus Mithörton durch Pulsweitenmodulation}{17}{section.7.2}\protected@file@percent }
|
|
||||||
\@writefile{toc}{\contentsline {subsection}{\numberline {7.2.1}Grundlagen}{17}{subsection.7.2.1}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\contentsline {figure}{\numberline {7.1}{\ignorespaces Pulswellenmodulation\relax }}{18}{figure.caption.8}\protected@file@percent }
|
|
||||||
\@writefile{toc}{\contentsline {subsubsection}{\nonumberline Pulsweitenmodulation}{18}{subsubsection*.10}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\contentsline {figure}{\numberline {7.2}{\ignorespaces Symmetrisches Rechtecksignal an PB3\relax }}{19}{figure.caption.11}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\contentsline {figure}{\numberline {7.3}{\ignorespaces PWM - Tastgrad - Sinus\relax }}{20}{figure.caption.12}\protected@file@percent }
|
|
||||||
\BKM@entry{id=17,dest={73756273656374696F6E2E372E322E32},srcline={397},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030535C303030695C3030306E5C303030755C303030735C303030745C303030615C303030625C303030655C3030306C5C3030306C5C30303065}
|
|
||||||
\@writefile{lot}{\contentsline {table}{\numberline {7.1}{\ignorespaces OCR1A Werte für verschiedene Frequenzen des Mithörtons\relax }}{21}{table.caption.13}\protected@file@percent }
|
|
||||||
\@writefile{toc}{\contentsline {subsection}{\numberline {7.2.2}Sinustabelle}{21}{subsection.7.2.2}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\contentsline {figure}{\numberline {7.4}{\ignorespaces Sinus nach Tabelle vom Python3 Script als Linie\relax }}{21}{figure.caption.14}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\contentsline {figure}{\numberline {7.5}{\ignorespaces Sinus nach der Tabelle vom Python3 Script mit Stützpunkten\relax }}{22}{figure.caption.15}\protected@file@percent }
|
|
||||||
\BKM@entry{id=18,dest={636861707465722E38},srcline={429},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030455C3030306E5C303030745C303030775C303030695C303030635C3030306B5C3030306C5C303030755C3030306E5C303030675C303030735C303030755C3030306D5C303030675C303030655C303030625C303030755C3030306E5C30303067}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\numberline {8}Entwicklungsumgebung}{23}{chapter.8}\protected@file@percent }
|
|
||||||
\@writefile{lof}{\addvspace {10\p@ }}
|
|
||||||
\@writefile{lot}{\addvspace {10\p@ }}
|
|
||||||
\BKM@entry{id=19,dest={636861707465722A2E3136},srcline={455},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030545C303030615C303030625C303030655C3030306C5C3030306C5C303030655C3030306E}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\nonumberline Tabellen}{25}{chapter*.16}\protected@file@percent }
|
|
||||||
\gdef\lot@l@number{47.7639pt}
|
|
||||||
\BKM@entry{id=20,dest={636861707465722A2E3137},srcline={456},srcfile={2E2E2F446F63756D656E74732F446F6B756D656E746174696F6E20424A2D4B657965722E746578}}{5C3337365C3337375C303030415C303030625C303030625C303030695C3030306C5C303030645C303030755C3030306E5C303030675C303030655C3030306E}
|
|
||||||
\@writefile{toc}{\contentsline {chapter}{\nonumberline Abbildungen}{27}{chapter*.17}\protected@file@percent }
|
|
||||||
\gdef\lof@l@number{49.59253pt}
|
|
||||||
\global\@namedef{scr@dte@chapter@lastmaxnumwidth}{10.40242pt}
|
|
||||||
\global\@namedef{scr@dte@section@lastmaxnumwidth}{18.37404pt}
|
|
||||||
\global\@namedef{scr@dte@subsection@lastmaxnumwidth}{26.89314pt}
|
|
||||||
\global\@namedef{scr@dte@table@lastmaxnumwidth}{46.66884pt}
|
|
||||||
\global\@namedef{scr@dte@figure@lastmaxnumwidth}{48.49747pt}
|
|
||||||
\@writefile{toc}{\providecommand\tocbasic@end@toc@file{}\tocbasic@end@toc@file}
|
|
||||||
\@writefile{lot}{\providecommand\tocbasic@end@toc@file{}\tocbasic@end@toc@file}
|
|
||||||
\@writefile{lof}{\providecommand\tocbasic@end@toc@file{}\tocbasic@end@toc@file}
|
|
||||||
\gdef \@abspage@last{27}
|
|
@ -1,17 +0,0 @@
|
|||||||
\babel@toc {ngerman}{}
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\contentsline {figure}{\numberline {3.1}{\ignorespaces Diagramm Mode A\relax }}{9}{figure.caption.4}%
|
|
||||||
\contentsline {figure}{\numberline {3.2}{\ignorespaces Diagramm Mode B\relax }}{9}{figure.caption.5}%
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\contentsline {figure}{\numberline {7.1}{\ignorespaces Pulswellenmodulation\relax }}{18}{figure.caption.8}%
|
|
||||||
\contentsline {figure}{\numberline {7.2}{\ignorespaces Symmetrisches Rechtecksignal an PB3\relax }}{19}{figure.caption.11}%
|
|
||||||
\contentsline {figure}{\numberline {7.3}{\ignorespaces PWM - Tastgrad - Sinus\relax }}{20}{figure.caption.12}%
|
|
||||||
\contentsline {figure}{\numberline {7.4}{\ignorespaces Sinus nach Tabelle vom Python3 Script als Linie\relax }}{21}{figure.caption.14}%
|
|
||||||
\contentsline {figure}{\numberline {7.5}{\ignorespaces Sinus nach der Tabelle vom Python3 Script mit Stützpunkten\relax }}{22}{figure.caption.15}%
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\providecommand \tocbasic@end@toc@file {}\tocbasic@end@toc@file
|
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,13 +0,0 @@
|
|||||||
\babel@toc {ngerman}{}
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\contentsline {table}{\numberline {5.1}{\ignorespaces Programmierpunkte Teil 1\relax }}{13}{table.caption.6}%
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\contentsline {table}{\numberline {6.1}{\ignorespaces Klemmenbelegung\relax }}{15}{table.caption.7}%
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\contentsline {table}{\numberline {7.1}{\ignorespaces OCR1A Werte für verschiedene Frequenzen des Mithörtons\relax }}{21}{table.caption.13}%
|
|
||||||
\addvspace {10\p@ }
|
|
||||||
\providecommand \tocbasic@end@toc@file {}\tocbasic@end@toc@file
|
|
Binäre Datei nicht angezeigt.
@ -1,23 +0,0 @@
|
|||||||
\babel@toc {ngerman}{}
|
|
||||||
\contentsline {chapter}{\numberline {1}Funktionen}{5}{chapter.1}%
|
|
||||||
\contentsline {chapter}{\numberline {2}Hinweise zur Dokumentation}{7}{chapter.2}%
|
|
||||||
\contentsline {chapter}{\numberline {3}Grundlagen}{9}{chapter.3}%
|
|
||||||
\contentsline {section}{\numberline {3.1}Betriebsarten eines Morse-Keyers}{9}{section.3.1}%
|
|
||||||
\contentsline {subsection}{\numberline {3.1.1}Zeitverhalten}{9}{subsection.3.1.1}%
|
|
||||||
\contentsline {chapter}{\numberline {4}Bedienung}{11}{chapter.4}%
|
|
||||||
\contentsline {section}{\numberline {4.1}Tastaturbelegung}{11}{section.4.1}%
|
|
||||||
\contentsline {subsection}{\numberline {4.1.1}Übersicht}{11}{subsection.4.1.1}%
|
|
||||||
\contentsline {chapter}{\numberline {5}Schaltung}{13}{chapter.5}%
|
|
||||||
\contentsline {section}{\numberline {5.1}Beschreibung}{13}{section.5.1}%
|
|
||||||
\contentsline {chapter}{\numberline {6}Beschreibung der Hardware}{15}{chapter.6}%
|
|
||||||
\contentsline {chapter}{\numberline {7}Beschreibung der Software}{17}{chapter.7}%
|
|
||||||
\contentsline {section}{\numberline {7.1}Timer 1}{17}{section.7.1}%
|
|
||||||
\contentsline {subsection}{\numberline {7.1.1}Timer einstellen}{17}{subsection.7.1.1}%
|
|
||||||
\contentsline {section}{\numberline {7.2}Sinus Mithörton durch Pulsweitenmodulation}{17}{section.7.2}%
|
|
||||||
\contentsline {subsection}{\numberline {7.2.1}Grundlagen}{17}{subsection.7.2.1}%
|
|
||||||
\contentsline {subsubsection}{\nonumberline Pulsweitenmodulation}{18}{subsubsection*.10}%
|
|
||||||
\contentsline {subsection}{\numberline {7.2.2}Sinustabelle}{21}{subsection.7.2.2}%
|
|
||||||
\contentsline {chapter}{\numberline {8}Entwicklungsumgebung}{23}{chapter.8}%
|
|
||||||
\contentsline {chapter}{\nonumberline Tabellen}{25}{chapter*.16}%
|
|
||||||
\contentsline {chapter}{\nonumberline Abbildungen}{27}{chapter*.17}%
|
|
||||||
\providecommand \tocbasic@end@toc@file {}\tocbasic@end@toc@file
|
|
@ -152,7 +152,7 @@ EXTMEMOPTS =
|
|||||||
# --cref: add cross reference to map file
|
# --cref: add cross reference to map file
|
||||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
|
||||||
LDFLAGS += $(EXTMEMOPTS)
|
LDFLAGS += $(EXTMEMOPTS)
|
||||||
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
|
LDFLAGS += $(PRINTF_LIB_FLOAT) $(SCANF_LIB) $(MATH_LIB)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,11 +8,13 @@
|
|||||||
// Stringkonstanten für das Display
|
// Stringkonstanten für das Display
|
||||||
const char CALL[] = " DL7BJ ";
|
const char CALL[] = " DL7BJ ";
|
||||||
const char PRG[] = " BJ-Keyer ";
|
const char PRG[] = " BJ-Keyer ";
|
||||||
const char VER[] = " V1.0 ";
|
const char VER[] = " V1.00 ";
|
||||||
const char Trx1[] = "TRX 1";
|
const char Trx1[] = "TRX 1";
|
||||||
const char Trx2[] = "TRX 2";
|
const char Trx2[] = "TRX 2";
|
||||||
const char IambicA[] = "Iambic A";
|
const char IambicA[] = "Iambic A";
|
||||||
const char IambicB[] = "Iambic B";
|
const char IambicB[] = "Iambic B";
|
||||||
|
const char Ultimatic[] = "Ultimat.";
|
||||||
|
const char Memory[] = "Memory";
|
||||||
const char Ratio[] = "Ratio";
|
const char Ratio[] = "Ratio";
|
||||||
const char ReverseRL[] = " L - R °";
|
const char ReverseRL[] = " L - R °";
|
||||||
const char ReverseLR[] = " L ° R -";
|
const char ReverseLR[] = " L ° R -";
|
||||||
@ -59,28 +61,38 @@ void Drehencoder(void)
|
|||||||
|
|
||||||
if((bMenuCtrl.buttonPressedLong == 1) && (bMenuCtrl.Config == 1))
|
if((bMenuCtrl.buttonPressedLong == 1) && (bMenuCtrl.Config == 1))
|
||||||
{
|
{
|
||||||
bMenuCtrl.Config = 0;
|
if(bMenuCtrl.SubMenue == 1)
|
||||||
bMenuCtrl.Update = 1;
|
{
|
||||||
bMenuCtrl.buttonPressedLong = 0;
|
bMenuCtrl.SubMenue = 0;
|
||||||
bMenuCtrl.buttonPressed = 0;
|
bMenuCtrl.Update = 1;
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
bMenuCtrl.buttonPressedLong = 0;
|
||||||
MenuCtrlTimer = 0;
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
EncoderPosConfig = EncoderRead(1);
|
EncoderWrite(EncoderPosSubConfig);
|
||||||
EncoderWrite(EncoderPos);
|
Boop();
|
||||||
bMenuCtrl.ClrScr = 1;
|
} else {
|
||||||
Beep();
|
bMenuCtrl.Config = 0;
|
||||||
|
bMenuCtrl.Update = 1;
|
||||||
|
bMenuCtrl.buttonPressedLong = 0;
|
||||||
|
bMenuCtrl.buttonPressed = 0;
|
||||||
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
|
MenuCtrlTimer = 0;
|
||||||
|
EncoderPosConfig = EncoderRead(1);
|
||||||
|
EncoderWrite(EncoderPos);
|
||||||
|
bMenuCtrl.ClrScr = 1;
|
||||||
|
WriteEEprom();
|
||||||
|
Beep();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bMenuCtrl.Config == 1)
|
if(bMenuCtrl.Config == 1)
|
||||||
{
|
{
|
||||||
if(!bMenuCtrl.buttonPressed)
|
if((!bMenuCtrl.buttonPressed) && (bMenuCtrl.SubMenue == 0))
|
||||||
{
|
{
|
||||||
EncoderMinMax(1,M_MAX);
|
EncoderMinMax(1,M_MAX);
|
||||||
st = EncoderRead(1);
|
st = EncoderRead(1);
|
||||||
sprintf(sdebug,"Encoder %i\r\n",st);
|
sprintf(sdebug,"Encoder %i\r\n",st);
|
||||||
if(last != st)
|
if(last != st)
|
||||||
{
|
{
|
||||||
SendSerialString(sdebug);
|
|
||||||
bMenuCtrl.CurMenue = st;
|
bMenuCtrl.CurMenue = st;
|
||||||
bMenuCtrl.Update = 1;
|
bMenuCtrl.Update = 1;
|
||||||
}
|
}
|
||||||
@ -93,9 +105,10 @@ void Drehencoder(void)
|
|||||||
bMenuCtrl.buttonPressed = 0;
|
bMenuCtrl.buttonPressed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(bMenuCtrl.m_buttonPressed == 1)
|
if((bMenuCtrl.m_buttonPressed == 1) && (bMenuCtrl.SubMenue == 0))
|
||||||
{
|
{
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
|
bMenuCtrl.Update = 1;
|
||||||
switch(bMenuCtrl.CurMenue)
|
switch(bMenuCtrl.CurMenue)
|
||||||
{
|
{
|
||||||
case M_TRX1:
|
case M_TRX1:
|
||||||
@ -113,11 +126,15 @@ void Drehencoder(void)
|
|||||||
bMenuCtrl.m_buttonPressed = 0;
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
break;
|
break;
|
||||||
case M_IAMBICA:
|
case M_IAMBICA:
|
||||||
bConfig.IambicMode = 1;
|
bConfig.KeyerMode = IAMBIC_A;
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
break;
|
break;
|
||||||
case M_IAMBICB:
|
case M_IAMBICB:
|
||||||
bConfig.IambicMode = 2;
|
bConfig.KeyerMode = IAMBIC_B;
|
||||||
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
|
break;
|
||||||
|
case M_ULTIMATIC:
|
||||||
|
bConfig.KeyerMode = ULTIMATIC;
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
break;
|
break;
|
||||||
case M_REVERSE:
|
case M_REVERSE:
|
||||||
@ -125,22 +142,98 @@ void Drehencoder(void)
|
|||||||
bConfig.Reverse = 0;
|
bConfig.Reverse = 0;
|
||||||
else
|
else
|
||||||
bConfig.Reverse = 1;
|
bConfig.Reverse = 1;
|
||||||
bMenuCtrl.m_buttonPressed = 0;
|
|
||||||
if(bConfig.Reverse == 1)
|
if(bConfig.Reverse == 1)
|
||||||
PaddleMode = PADDLE_REVERSE;
|
PaddleMode = PADDLE_REVERSE;
|
||||||
else
|
else
|
||||||
PaddleMode = PADDLE_NORMAL;
|
PaddleMode = PADDLE_NORMAL;
|
||||||
bMenuCtrl.Update = 1;
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
break;
|
break;
|
||||||
|
case M_RATIO:
|
||||||
|
bMenuCtrl.SubMenue = 1;
|
||||||
|
EncoderPosSubConfig = EncoderRead(1);
|
||||||
|
break;
|
||||||
|
case M_MEMORY:
|
||||||
|
bConfig.Memory = (bConfig.Memory == 1) ? 0 : 1;
|
||||||
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
|
break;
|
||||||
|
case M_WPMBPM:
|
||||||
|
bConfig.WpMBpM = (bConfig.WpMBpM == 1) ? 0 : 1;
|
||||||
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
|
break;
|
||||||
|
case M_TON:
|
||||||
|
bConfig.SidetoneEnabled = (bConfig.SidetoneEnabled == 1) ? 0 : 1;
|
||||||
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
|
break;
|
||||||
|
case M_TON_FREQ:
|
||||||
|
bMenuCtrl.SubMenue = 1;
|
||||||
|
EncoderPosSubConfig = EncoderRead(1);
|
||||||
|
break;
|
||||||
|
case M_RISETIME:
|
||||||
|
bMenuCtrl.SubMenue = 1;
|
||||||
|
EncoderPosSubConfig = EncoderRead(1);
|
||||||
|
break;
|
||||||
|
case M_DEBOUNCE:
|
||||||
|
bMenuCtrl.SubMenue = 1;
|
||||||
|
EncoderPosSubConfig = EncoderRead(1);
|
||||||
|
break;
|
||||||
|
case M_WINKEYER:
|
||||||
|
bConfig.WinkeyerEnabled = (bConfig.WinkeyerEnabled == 1) ? 0 : 1;
|
||||||
|
bMenuCtrl.m_buttonPressed = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Einstellungen für variable Werte
|
||||||
|
if((bMenuCtrl.m_buttonPressed == 1) && (bMenuCtrl.SubMenue == 1))
|
||||||
|
{
|
||||||
|
UpdateDisplay();
|
||||||
|
switch(bMenuCtrl.CurMenue)
|
||||||
|
{
|
||||||
case M_RATIO:
|
case M_RATIO:
|
||||||
EncoderMinMax(15,30);
|
EncoderMinMax(15,30);
|
||||||
|
EncoderWrite(bConfig.Ratio);
|
||||||
st = EncoderRead(1);
|
st = EncoderRead(1);
|
||||||
|
if(st != bConfig.Ratio)
|
||||||
|
bMenuCtrl.Update = 1;
|
||||||
bConfig.Ratio = st;
|
bConfig.Ratio = st;
|
||||||
if(bConfig.Ratio > 30) bConfig.Ratio = 30;
|
if(bConfig.Ratio > 30) bConfig.Ratio = 30;
|
||||||
if(bConfig.Ratio < 15) bConfig.Ratio = 15;
|
if(bConfig.Ratio < 15) bConfig.Ratio = 15;
|
||||||
bMenuCtrl.Update = 1;
|
|
||||||
break;
|
break;
|
||||||
case M_TON_FREQ:
|
case M_TON_FREQ:
|
||||||
|
EncoderMinMax(30,100);
|
||||||
|
EncoderWrite(bConfig.SidetoneFreq/10);
|
||||||
|
st = EncoderRead(1);
|
||||||
|
if(st != bConfig.SidetoneFreq/10)
|
||||||
|
{
|
||||||
|
bConfig.SidetoneFreq = st * 10;
|
||||||
|
if(bConfig.SidetoneFreq > 1000) bConfig.SidetoneFreq = 1000;
|
||||||
|
if(bConfig.SidetoneFreq < 300) bConfig.SidetoneFreq = 300;
|
||||||
|
bMenuCtrl.Update = 1;
|
||||||
|
Tone(bConfig.SidetoneFreq, 250);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case M_RISETIME:
|
||||||
|
EncoderMinMax(1,10);
|
||||||
|
EncoderWrite(bConfig.RiseTime);
|
||||||
|
st = EncoderRead(1);
|
||||||
|
if(st != bConfig.RiseTime)
|
||||||
|
{
|
||||||
|
bConfig.RiseTime = st;
|
||||||
|
if(bConfig.RiseTime > 10) bConfig.RiseTime = 10;
|
||||||
|
if(bConfig.RiseTime < 1) bConfig.RiseTime = 1;
|
||||||
|
bMenuCtrl.Update = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case M_DEBOUNCE:
|
||||||
|
EncoderMinMax(1,25);
|
||||||
|
EncoderWrite(bConfig.DebounceTime);
|
||||||
|
st = EncoderRead(1);
|
||||||
|
if(st != bConfig.DebounceTime)
|
||||||
|
{
|
||||||
|
bConfig.DebounceTime = st;
|
||||||
|
if(bConfig.DebounceTime > 25) bConfig.DebounceTime = 25;
|
||||||
|
if(bConfig.DebounceTime < 1) bConfig.DebounceTime = 1;
|
||||||
|
bMenuCtrl.Update = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +249,10 @@ void ConfigMenue(void)
|
|||||||
lcd_gotoxy(0,0);
|
lcd_gotoxy(0,0);
|
||||||
lcd_puts(CLEARLINE);
|
lcd_puts(CLEARLINE);
|
||||||
lcd_gotoxy(0,0);
|
lcd_gotoxy(0,0);
|
||||||
sprintf(line,"%s - %i","Einstellungen", bMenuCtrl.CurMenue);
|
if(bMenuCtrl.SubMenue == 0)
|
||||||
|
sprintf(line,"%s - %i","Einstellungen", bMenuCtrl.CurMenue);
|
||||||
|
else
|
||||||
|
sprintf(line,"%s * %i","Einstellungen", bMenuCtrl.CurMenue);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
lcd_charMode(DOUBLESIZE);
|
lcd_charMode(DOUBLESIZE);
|
||||||
lcd_gotoxy(0,3);
|
lcd_gotoxy(0,3);
|
||||||
@ -181,20 +277,28 @@ void ConfigMenue(void)
|
|||||||
break;
|
break;
|
||||||
case M_IAMBICA:
|
case M_IAMBICA:
|
||||||
lcd_gotoxy(0,3);
|
lcd_gotoxy(0,3);
|
||||||
if(bConfig.IambicMode == 1)
|
if(bConfig.KeyerMode == IAMBIC_A)
|
||||||
sprintf(line,"[%s]", IambicA);
|
sprintf(line,"[%s]", IambicA);
|
||||||
else
|
else
|
||||||
sprintf(line," %s ", IambicB);
|
sprintf(line," %s ", IambicA);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
break;
|
break;
|
||||||
case M_IAMBICB:
|
case M_IAMBICB:
|
||||||
lcd_gotoxy(0,3);
|
lcd_gotoxy(0,3);
|
||||||
if(bConfig.IambicMode == 2)
|
if(bConfig.KeyerMode == IAMBIC_B)
|
||||||
sprintf(line,"[%s]", IambicB);
|
sprintf(line,"[%s]", IambicB);
|
||||||
else
|
else
|
||||||
sprintf(line," %s ", IambicB);
|
sprintf(line," %s ", IambicB);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
break;
|
break;
|
||||||
|
case M_ULTIMATIC:
|
||||||
|
lcd_gotoxy(0,3);
|
||||||
|
if(bConfig.KeyerMode == ULTIMATIC)
|
||||||
|
sprintf(line,"[%s]", Ultimatic);
|
||||||
|
else
|
||||||
|
sprintf(line," %s ", Ultimatic);
|
||||||
|
lcd_puts(line);
|
||||||
|
break;
|
||||||
case M_REVERSE:
|
case M_REVERSE:
|
||||||
lcd_gotoxy(0,3);
|
lcd_gotoxy(0,3);
|
||||||
if(bConfig.Reverse == 0)
|
if(bConfig.Reverse == 0)
|
||||||
@ -208,15 +312,23 @@ void ConfigMenue(void)
|
|||||||
if(bConfig.Ratio == 30)
|
if(bConfig.Ratio == 30)
|
||||||
sprintf(line,"%s", "Ratio 3:1");
|
sprintf(line,"%s", "Ratio 3:1");
|
||||||
else
|
else
|
||||||
sprintf(line,"%s %i:1", "Ratio", bConfig.Ratio/10);
|
sprintf(line,"%s %.1f", "Ratio", (float)bConfig.Ratio/10);
|
||||||
|
lcd_puts(line);
|
||||||
|
break;
|
||||||
|
case M_MEMORY:
|
||||||
|
lcd_gotoxy(0,3);
|
||||||
|
if(bConfig.Memory == 1)
|
||||||
|
sprintf(line,"[%s]", Memory);
|
||||||
|
else
|
||||||
|
sprintf(line," %s ", Memory);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
break;
|
break;
|
||||||
case M_TON_FREQ:
|
case M_TON_FREQ:
|
||||||
lcd_gotoxy(0,3);
|
lcd_gotoxy(0,3);
|
||||||
if(bConfig.FrequencySidetone == 650)
|
if(bConfig.SidetoneFreq == 650)
|
||||||
sprintf(line,"%s", "Ton 650Hz");
|
sprintf(line,"%s", "Ton 650Hz");
|
||||||
else
|
else
|
||||||
sprintf(line,"%s %uHz", "Ton", bConfig.FrequencySidetone);
|
sprintf(line,"%s %uHz", "Ton", bConfig.SidetoneFreq);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
break;
|
break;
|
||||||
case M_TON:
|
case M_TON:
|
||||||
@ -230,9 +342,9 @@ void ConfigMenue(void)
|
|||||||
case M_WPMBPM:
|
case M_WPMBPM:
|
||||||
lcd_gotoxy(0,3);
|
lcd_gotoxy(0,3);
|
||||||
if(bConfig.WpMBpM == 0)
|
if(bConfig.WpMBpM == 0)
|
||||||
sprintf(line,"%s", "WpM");
|
sprintf(line,"%s", "[WpM] BpM");
|
||||||
else
|
else
|
||||||
sprintf(line,"%s", "BpM");
|
sprintf(line,"%s", "WpM [BpM]");
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
break;
|
break;
|
||||||
case M_RISETIME:
|
case M_RISETIME:
|
||||||
@ -245,6 +357,14 @@ void ConfigMenue(void)
|
|||||||
sprintf(line,"%s %ims",DebounceTime, bConfig.DebounceTime);
|
sprintf(line,"%s %ims",DebounceTime, bConfig.DebounceTime);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
break;
|
break;
|
||||||
|
case M_WINKEYER:
|
||||||
|
lcd_gotoxy(0,3);
|
||||||
|
if(bConfig.WinkeyerEnabled)
|
||||||
|
sprintf(line,"[%s]","WinKey");
|
||||||
|
else
|
||||||
|
sprintf(line," %s ","WinKey");
|
||||||
|
lcd_puts(line);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
bMenuCtrl.Update = 0;
|
bMenuCtrl.Update = 0;
|
||||||
lcd_charMode(NORMAL);
|
lcd_charMode(NORMAL);
|
||||||
@ -286,16 +406,16 @@ void UpdateDisplay(void)
|
|||||||
{
|
{
|
||||||
lcd_charMode(DOUBLESIZE);
|
lcd_charMode(DOUBLESIZE);
|
||||||
lcd_gotoxy(4,3);
|
lcd_gotoxy(4,3);
|
||||||
if(bConfig.WpMBpM)
|
if(bConfig.WpMBpM == 0)
|
||||||
sprintf(line,"%i WpM ",bConfig.WpM);
|
sprintf(line,"%i WpM ",bConfig.WpM);
|
||||||
else
|
else
|
||||||
sprintf(line,"%i BpM ", bConfig.WpM*5);
|
sprintf(line,"%i BpM ", bConfig.WpM*5);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
lcd_charMode(NORMAL);
|
lcd_charMode(NORMAL);
|
||||||
lcd_gotoxy(13,0);
|
lcd_gotoxy(13,0);
|
||||||
if(bConfig.IambicMode == 1)
|
if(bConfig.KeyerMode == IAMBIC_A)
|
||||||
sprintf(line,"%s", IambicA);
|
sprintf(line,"%s", IambicA);
|
||||||
if(bConfig.IambicMode == 2)
|
if(bConfig.KeyerMode == IAMBIC_B)
|
||||||
sprintf(line,"%s", IambicB);
|
sprintf(line,"%s", IambicB);
|
||||||
lcd_puts(line);
|
lcd_puts(line);
|
||||||
lcd_gotoxy(0,0);
|
lcd_gotoxy(0,0);
|
||||||
@ -311,7 +431,6 @@ void UpdateDisplay(void)
|
|||||||
{
|
{
|
||||||
ConfigMenue();
|
ConfigMenue();
|
||||||
}
|
}
|
||||||
bMenuCtrl.Update = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,14 @@ extern uint8_t WpM;
|
|||||||
// Externe Funktionen
|
// Externe Funktionen
|
||||||
extern void Boop(void);
|
extern void Boop(void);
|
||||||
extern void Beep(void);
|
extern void Beep(void);
|
||||||
|
extern void WriteEEprom(void);
|
||||||
|
extern void SideToneOff(void);
|
||||||
|
extern void DelayMilliSeconds(uint16_t t);
|
||||||
|
extern void Tone(uint16_t f, uint8_t t);
|
||||||
// Prototypes
|
// Prototypes
|
||||||
void Drehencoder(void);
|
void Drehencoder(void);
|
||||||
void ConfigMenue(void);
|
void ConfigMenue(void);
|
||||||
void UpdateDisplay(void);
|
void UpdateDisplay(void);
|
||||||
|
void DisplayVersion(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,13 +7,21 @@
|
|||||||
|
|
||||||
// EEProm
|
// EEProm
|
||||||
uint8_t Dummy;
|
uint8_t Dummy;
|
||||||
uint8_t ee_Dummy EEMEM = 0x55; // Dummy for Address 0
|
uint8_t ee_Dummy EEMEM = 0x55; // Dummy for Address 0
|
||||||
uint8_t ee_WpM EEMEM = 12; // WpM
|
uint8_t ee_TRX EEMEM = 0; // TRX 1 oder 2 oder beide
|
||||||
uint8_t ee_Sidetone EEMEM = 1; // Mithörton An (1) oder Aus (0)
|
uint8_t ee_KeyerMode EEMEM = 1; // Iambic A, Iambic B oder Ultimatic
|
||||||
uint16_t ee_FrequencySidetone EEMEM = 600; // Frequenz des Mithörtons
|
uint8_t ee_SidetoneEnabled EEMEM = 1; // Mithörton eingeschaltet
|
||||||
uint8_t ee_IambicMode EEMEM = 0; // Iambic Mode A oder B
|
uint8_t ee_WpMBpM EEMEM = 0; // WpM oder BpM Anzeige
|
||||||
uint8_t ee_Weight EEMEM = 3; // Dah dit Ratio
|
uint8_t ee_Reverse EEMEM = 0; // linkes/rechtes Paddle vertauschen
|
||||||
uint8_t ee_TRX EEMEM = 2; // TRX 1 (0), TRX 2 (1), Beide (2)
|
uint8_t ee_WinkeyerEnabled EEMEM = 0; // Winkeyer Emulation
|
||||||
|
uint8_t ee_Ratio EEMEM = 30; // Punkt/Strich Verhältnis 1:3
|
||||||
|
uint8_t ee_Memory EEMEM = 0; // Punkt/Strich Speicher
|
||||||
|
uint16_t ee_SidetoneFreq EEMEM = 600; // Frequenz des Mithörtons
|
||||||
|
uint8_t ee_WpM EEMEM = 12; // WpM
|
||||||
|
uint8_t ee_RiseTime EEMEM = 5; // Anstiegszeit Sinuston
|
||||||
|
uint8_t ee_RiseTimeCounter EEMEM = 5; // Anzahl Sinusschwingungen für den Anstieg
|
||||||
|
uint8_t ee_DebounceTime EEMEM = 6; // Entprellzeit für Straight Key Eingang
|
||||||
|
|
||||||
|
|
||||||
// Stringkonstanten für VT100 Terminals
|
// Stringkonstanten für VT100 Terminals
|
||||||
char CLRSCR[] = "\033[2J";
|
char CLRSCR[] = "\033[2J";
|
||||||
@ -87,23 +95,18 @@ void WriteEEprom(void)
|
|||||||
cli();
|
cli();
|
||||||
eeprom_write_byte(&ee_Dummy,0x55);
|
eeprom_write_byte(&ee_Dummy,0x55);
|
||||||
eeprom_write_byte(&ee_WpM, bConfig.WpM);
|
eeprom_write_byte(&ee_WpM, bConfig.WpM);
|
||||||
eeprom_write_byte(&ee_IambicMode, bConfig.IambicMode);
|
eeprom_write_byte(&ee_KeyerMode, bConfig.KeyerMode);
|
||||||
eeprom_write_word(&ee_FrequencySidetone, bConfig.FrequencySidetone);
|
eeprom_write_word(&ee_SidetoneFreq, bConfig.SidetoneFreq);
|
||||||
eeprom_write_byte(&ee_TRX, bConfig.TRX);
|
eeprom_write_byte(&ee_TRX, bConfig.TRX);
|
||||||
sei();
|
eeprom_write_byte(&ee_SidetoneEnabled, bConfig.SidetoneEnabled);
|
||||||
}
|
eeprom_write_byte(&ee_WpMBpM, bConfig.WpMBpM);
|
||||||
|
eeprom_write_byte(&ee_Reverse, bConfig.Reverse);
|
||||||
void ReadEEprom(void)
|
eeprom_write_byte(&ee_WinkeyerEnabled, bConfig.WinkeyerEnabled);
|
||||||
{
|
eeprom_write_byte(&ee_Ratio, bConfig.Ratio);
|
||||||
// wpm = eeprom_read_byte(&ee_wpm);
|
eeprom_write_byte(&ee_Memory, bConfig.Memory);
|
||||||
}
|
eeprom_write_byte(&ee_RiseTime, bConfig.RiseTime);
|
||||||
|
eeprom_write_byte(&ee_RiseTimeCounter, bConfig.RiseTimeCounter);
|
||||||
void WriteEEpromWpM(void)
|
eeprom_write_byte(&ee_DebounceTime, bConfig.DebounceTime);
|
||||||
{
|
|
||||||
cli();
|
|
||||||
sprintf(sdebug," %i WpM in EEprom schreiben\r\n",bConfig.WpM);
|
|
||||||
SendSerialString(sdebug);
|
|
||||||
eeprom_write_byte(&ee_WpM, bConfig.WpM);
|
|
||||||
sei();
|
sei();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,29 +115,75 @@ void ReadEEpromWpM(void)
|
|||||||
cli();
|
cli();
|
||||||
bConfig.WpM = eeprom_read_byte(&ee_WpM);
|
bConfig.WpM = eeprom_read_byte(&ee_WpM);
|
||||||
sei();
|
sei();
|
||||||
sprintf(sdebug," %i WpM von EEprom gelesen\r\n",bConfig.WpM);
|
}
|
||||||
SendSerialString(sdebug);
|
|
||||||
|
void WriteEEpromWpM(void)
|
||||||
|
{
|
||||||
|
cli();
|
||||||
|
eeprom_write_byte(&ee_WpM, bConfig.WpM);
|
||||||
|
sei();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReadEEprom(void)
|
||||||
|
{
|
||||||
|
sprintf(sdebug,"EEprom lesen\r\n");
|
||||||
|
SerialWriteString(sdebug);
|
||||||
|
cli();
|
||||||
|
bConfig.WpM = eeprom_read_byte(&ee_WpM);
|
||||||
|
bConfig.KeyerMode = eeprom_read_byte(&ee_KeyerMode);
|
||||||
|
bConfig.SidetoneFreq = eeprom_read_word(&ee_SidetoneFreq);
|
||||||
|
bConfig.TRX = eeprom_read_byte(&ee_TRX);
|
||||||
|
bConfig.SidetoneEnabled = eeprom_read_byte(&ee_SidetoneEnabled);
|
||||||
|
bConfig.WpMBpM = eeprom_read_byte(&ee_WpMBpM);
|
||||||
|
bConfig.Reverse = eeprom_read_byte(&ee_Reverse);
|
||||||
|
bConfig.WinkeyerEnabled = eeprom_read_byte(&ee_WinkeyerEnabled);
|
||||||
|
bConfig.Ratio = eeprom_read_byte(&ee_Ratio);
|
||||||
|
bConfig.Memory = eeprom_read_byte(&ee_Memory);
|
||||||
|
bConfig.RiseTime = eeprom_read_byte(&ee_RiseTime);
|
||||||
|
bConfig.RiseTimeCounter = eeprom_read_byte(&ee_RiseTimeCounter);
|
||||||
|
bConfig.DebounceTime = eeprom_read_byte(&ee_DebounceTime);
|
||||||
|
sei();
|
||||||
if(bConfig.WpM > 50) {
|
if(bConfig.WpM > 50) {
|
||||||
bConfig.WpM = 15;
|
bConfig.WpM = 15;
|
||||||
WriteEEpromWpM();
|
WriteEEpromWpM();
|
||||||
}
|
}
|
||||||
|
if(bConfig.RiseTime > 10) {
|
||||||
|
bConfig.RiseTime = 10;
|
||||||
|
WriteEEprom();
|
||||||
|
}
|
||||||
|
if(bConfig.RiseTimeCounter > 6) {
|
||||||
|
bConfig.RiseTimeCounter = 6;
|
||||||
|
WriteEEprom();
|
||||||
|
}
|
||||||
|
if(bConfig.DebounceTime > 22) {
|
||||||
|
bConfig.DebounceTime = 25;
|
||||||
|
WriteEEprom();
|
||||||
|
}
|
||||||
|
sprintf(sdebug,"WpM : %i\r\n", bConfig.WpM);
|
||||||
|
SerialWriteString(sdebug);
|
||||||
|
sprintf(sdebug,"SidetoneFreq: %ul\r\n", bConfig.SidetoneFreq);
|
||||||
|
SerialWriteString(sdebug);
|
||||||
|
sprintf(sdebug,"WpMBpM : %i\r\n", bConfig.WpMBpM);
|
||||||
|
SerialWriteString(sdebug);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendSerialChar(unsigned char data)
|
void SerialWriteChar(unsigned char data)
|
||||||
{
|
{
|
||||||
while(!(UCSR0A & (1<<UDRE0)));
|
while(!(UCSR0A & (1<<UDRE0)));
|
||||||
UDR0 = data;
|
UDR0 = data;
|
||||||
}
|
}
|
||||||
void SendSerialString(char *s)
|
void SerialWriteString(char *s)
|
||||||
{
|
{
|
||||||
while(*s != 0x00)
|
while(*s != 0x00)
|
||||||
SendSerialChar(*s++);
|
SerialWriteChar(*s++);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \brief Read port pin of morse keys
|
/** @brief Read port pin of morse keys
|
||||||
|
*
|
||||||
* This function reads the input of
|
* This function reads the input of
|
||||||
* the Paddle or Straight key.
|
* the Paddle or Straight key.
|
||||||
*
|
* @params: Pin to read
|
||||||
|
* @return: State of pin
|
||||||
*/
|
*/
|
||||||
uint8_t ReadKeyPin(uint8_t pin)
|
uint8_t ReadKeyPin(uint8_t pin)
|
||||||
{
|
{
|
||||||
@ -199,14 +248,14 @@ void CheckStraightKey(void)
|
|||||||
if(PIND & (1<<STRAIGHT_KEY))
|
if(PIND & (1<<STRAIGHT_KEY))
|
||||||
{
|
{
|
||||||
TXKey(0,MAN);
|
TXKey(0,MAN);
|
||||||
StateStraightKeyPressed = 0;
|
StateStraightKeyPressed = NO_KEY_PRESSED;
|
||||||
} else {
|
} else {
|
||||||
if(StateStraightKeyPressed == 0)
|
if(StateStraightKeyPressed == NO_KEY_PRESSED)
|
||||||
{
|
{
|
||||||
StateStraightKeyPressed = 1;
|
StateStraightKeyPressed = KEY_PRESSED_DEBOUNCE;
|
||||||
TimerStraightKeyPressed = 0;
|
TimerStraightKeyPressed = 0;
|
||||||
}
|
}
|
||||||
if(StateStraightKeyPressed == 2)
|
if(StateStraightKeyPressed == KEY_PRESSED)
|
||||||
{
|
{
|
||||||
TXKey(1,MAN);
|
TXKey(1,MAN);
|
||||||
}
|
}
|
||||||
@ -226,81 +275,104 @@ void CheckPaddles(void)
|
|||||||
*/
|
*/
|
||||||
void CheckDitPaddle(void)
|
void CheckDitPaddle(void)
|
||||||
{
|
{
|
||||||
uint8_t pinvalue = 0;
|
static uint8_t pinvalue = 0;
|
||||||
uint8_t ditpaddle = 0;
|
|
||||||
|
|
||||||
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
|
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
|
||||||
ditpaddle = LEFT_PADDLE;
|
pinvalue = PIND & (1<<LEFT_PADDLE);
|
||||||
else
|
else
|
||||||
ditpaddle = RIGHT_PADDLE; // reverse paddle
|
pinvalue = PIND & (1<<RIGHT_PADDLE); // reverse paddle
|
||||||
|
|
||||||
pinvalue = ReadKeyPin(ditpaddle);
|
if(pinvalue == 0) // ditpaddle pressed
|
||||||
|
{
|
||||||
if(pinvalue == 0)
|
if(StatePaddleKeyPressed == NO_KEY_PRESSED) // First time, start debounce
|
||||||
DitBuffer = 1;
|
{
|
||||||
|
StatePaddleKeyPressed = KEY_PRESSED_DEBOUNCE;
|
||||||
|
TimerPaddleKeyPressed = 0;
|
||||||
|
}
|
||||||
|
if(StatePaddleKeyPressed == KEY_PRESSED) // Debounce ok
|
||||||
|
{
|
||||||
|
DitBuffer = 1;
|
||||||
|
StatePaddleKeyPressed = NO_KEY_PRESSED;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** CheckDahPaddle
|
** CheckDahPaddle
|
||||||
*/
|
*/
|
||||||
void CheckDahPaddle(void)
|
void CheckDahPaddle(void)
|
||||||
{
|
{
|
||||||
uint8_t pinvalue = 0;
|
static uint8_t pinvalue = 0;
|
||||||
uint8_t dahpaddle = 0;
|
|
||||||
|
|
||||||
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
|
if(PaddleMode == PADDLE_NORMAL) // no reverse paddle
|
||||||
dahpaddle = RIGHT_PADDLE;
|
pinvalue = PIND & (1<<RIGHT_PADDLE);
|
||||||
else
|
else
|
||||||
dahpaddle = LEFT_PADDLE; // reverse paddle
|
pinvalue = PIND & (1<<LEFT_PADDLE); // reverse paddle
|
||||||
|
|
||||||
pinvalue = ReadKeyPin(dahpaddle);
|
if(pinvalue == 0)
|
||||||
|
{
|
||||||
if(pinvalue == 0) {
|
if(StatePaddleKeyPressed == NO_KEY_PRESSED)
|
||||||
if(DahBuffer == 0) {
|
{
|
||||||
DahCounter++;
|
StatePaddleKeyPressed = KEY_PRESSED_DEBOUNCE;
|
||||||
DitCounter = 0;
|
TimerPaddleKeyPressed = 0;
|
||||||
|
}
|
||||||
|
if(StatePaddleKeyPressed == KEY_PRESSED) // Debounce ok
|
||||||
|
{
|
||||||
|
if(DahBuffer == 0)
|
||||||
|
{
|
||||||
|
DahCounter++;
|
||||||
|
DitCounter = 0;
|
||||||
|
}
|
||||||
|
DahBuffer = 1;
|
||||||
}
|
}
|
||||||
DahBuffer = 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** \brief Schleife für die Dauer der Zeichenelemente
|
/** @brief Schleife für die Dauer eines Zeichenelements Dit oder Dah
|
||||||
**
|
*
|
||||||
** len = count of dits * weigthing / 50
|
* Bei einer Geschwindigkeit von 12WpM (60BpM) hat ein Dit
|
||||||
** AddMiliSeconds = increase pausing between elements
|
* eine Länge von 100ms, ein Dah eine Länge von 300ms. In
|
||||||
** SendingType = AUTO or MAN
|
* dieser Zeit müssen die Paddle Eingänge weiter abgefragt
|
||||||
|
* werden, damit keine Zeichen verloren gehen.
|
||||||
|
*
|
||||||
|
* @param len Count of dits * weigthing / 50
|
||||||
|
* @param AddMiliSeconds Increase pausing between elements
|
||||||
|
* @param SendingType AUTO or MAN
|
||||||
|
* @return none
|
||||||
*/
|
*/
|
||||||
void ElementLoop(uint8_t len, uint8_t AddMilliSeconds, uint8_t SendingType)
|
void ElementLoop(uint8_t len, uint8_t AddMilliSeconds, uint8_t SendingType)
|
||||||
{
|
{
|
||||||
uint16_t LoE; // lengths of one element in ms
|
uint16_t LoE; // lengths of one element in ms
|
||||||
uint16_t ticks; // lengths of len elements + AddMilliSeconds in ms
|
uint16_t ticks; // lengths of elements + AddMilliSeconds in ms
|
||||||
|
|
||||||
if((len == 0) || (len < 0))
|
if((len == 0) || (len < 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LoE = 1200/WpM;
|
LoE = 1200/WpM; // Calculate length of one element
|
||||||
ticks = LoE * len + AddMilliSeconds;
|
ticks = LoE * len + AddMilliSeconds; //
|
||||||
mselement = 0; // Reset Timer 0 variable
|
t_elementlength = 0; // Reset Timer 0 variable
|
||||||
while(mselement < ticks) {
|
while(t_elementlength < ticks)
|
||||||
|
{
|
||||||
|
|
||||||
if((KeyerMode == IAMBIC_A) && (!(ReadKeyPin(LEFT_PADDLE))) && (!(ReadKeyPin(RIGHT_PADDLE))))
|
if((KeyerMode == IAMBIC_A) && (!(PIND & (1<<LEFT_PADDLE))) && (!(PIND & (1<<RIGHT_PADDLE))))
|
||||||
IambicFlag = 1;
|
IambicFlag = 1;
|
||||||
|
|
||||||
if(SendStatus == SENDING_DIT)
|
if(SendStatus == SENDING_DIT)
|
||||||
CheckDahPaddle();
|
CheckDahPaddle();
|
||||||
else if(SendStatus == SENDING_DAH)
|
else if(SendStatus == SENDING_DAH)
|
||||||
CheckDitPaddle();
|
CheckDitPaddle();
|
||||||
else {
|
else {
|
||||||
CheckDahPaddle();
|
CheckDahPaddle();
|
||||||
CheckDitPaddle();
|
CheckDitPaddle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((KeyerMode == IAMBIC_A) && (IambicFlag) && ReadKeyPin(LEFT_PADDLE) && ReadKeyPin(RIGHT_PADDLE)) {
|
if((KeyerMode == IAMBIC_A) && (IambicFlag) && (PIND & (1<<LEFT_PADDLE)) && (PIND & (1<<RIGHT_PADDLE)))
|
||||||
IambicFlag = 0;
|
{
|
||||||
DitBuffer = 0;
|
IambicFlag = 0;
|
||||||
DahBuffer = 0;
|
DitBuffer = 0;
|
||||||
}
|
DahBuffer = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** void SendDit(uint8_t SendingType)
|
** void SendDit(uint8_t SendingType)
|
||||||
@ -322,7 +394,7 @@ void SendDah(uint8_t SendingType)
|
|||||||
TXKey(1,SendingType);
|
TXKey(1,SendingType);
|
||||||
ElementLoop(3,0,SendingType);
|
ElementLoop(3,0,SendingType);
|
||||||
TXKey(0,SendingType);
|
TXKey(0,SendingType);
|
||||||
ElementLoop(1,0,SendingType);
|
ElementLoop(3,0,SendingType);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** Set sidetone frequency
|
** Set sidetone frequency
|
||||||
@ -343,7 +415,7 @@ void Tone(uint16_t f, uint8_t duration)
|
|||||||
SideToneOn();
|
SideToneOn();
|
||||||
DelayMilliSeconds(duration);
|
DelayMilliSeconds(duration);
|
||||||
SideToneOff();
|
SideToneOff();
|
||||||
SetFrequency(bConfig.FrequencySidetone);
|
SetFrequency(bConfig.SidetoneFreq);
|
||||||
}
|
}
|
||||||
void Boop(void)
|
void Boop(void)
|
||||||
{
|
{
|
||||||
|
@ -34,8 +34,8 @@ void ReadEEprom(void);
|
|||||||
void WriteEEpromWpM(void);
|
void WriteEEpromWpM(void);
|
||||||
void ReadEEpromWpM(void);
|
void ReadEEpromWpM(void);
|
||||||
// Serielle Schnittstelle
|
// Serielle Schnittstelle
|
||||||
void SendSerialString(char *s);
|
void SerialWriteString(char *s);
|
||||||
void SendSerialChar(unsigned char data);
|
void SerialWriteChar(unsigned char data);
|
||||||
// Delay Millis
|
// Delay Millis
|
||||||
void DelayMilliSeconds(uint16_t ms);
|
void DelayMilliSeconds(uint16_t ms);
|
||||||
void ResetMilliSeconds(void);
|
void ResetMilliSeconds(void);
|
||||||
|
@ -54,7 +54,8 @@
|
|||||||
#define STRAIGHT 0
|
#define STRAIGHT 0
|
||||||
#define IAMBIC_B 1
|
#define IAMBIC_B 1
|
||||||
#define IAMBIC_A 2
|
#define IAMBIC_A 2
|
||||||
#define SINGLE_PADDLE 3
|
#define ULTIMATIC 3
|
||||||
|
#define SINGLE_PADDLE 4
|
||||||
// Paddle Mode
|
// Paddle Mode
|
||||||
#define PADDLE_NORMAL 0
|
#define PADDLE_NORMAL 0
|
||||||
#define PADDLE_REVERSE 1
|
#define PADDLE_REVERSE 1
|
||||||
@ -100,12 +101,15 @@
|
|||||||
#define M_TON_FREQ 4
|
#define M_TON_FREQ 4
|
||||||
#define M_IAMBICA 5
|
#define M_IAMBICA 5
|
||||||
#define M_IAMBICB 6
|
#define M_IAMBICB 6
|
||||||
#define M_REVERSE 7
|
#define M_ULTIMATIC 7
|
||||||
#define M_RATIO 8
|
#define M_MEMORY 8
|
||||||
#define M_WPMBPM 9
|
#define M_REVERSE 9
|
||||||
#define M_RISETIME 10
|
#define M_RATIO 10
|
||||||
#define M_DEBOUNCE 11
|
#define M_WPMBPM 11
|
||||||
#define M_MAX 11 // maximale Menuepunke
|
#define M_RISETIME 12
|
||||||
|
#define M_DEBOUNCE 13
|
||||||
|
#define M_WINKEYER 14
|
||||||
|
#define M_MAX 14 // maximale Menuepunke
|
||||||
// LCD
|
// LCD
|
||||||
#define CLEARLINE " "
|
#define CLEARLINE " "
|
||||||
#define NORMAL 0
|
#define NORMAL 0
|
||||||
@ -118,36 +122,38 @@ struct Merker
|
|||||||
{
|
{
|
||||||
uint8_t WpMChanged: 1;
|
uint8_t WpMChanged: 1;
|
||||||
uint8_t WriteWpMEEprom: 1;
|
uint8_t WriteWpMEEprom: 1;
|
||||||
|
uint8_t WriteEEprom: 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MenuCtrl
|
struct MenuCtrl
|
||||||
{
|
{
|
||||||
uint8_t buttonPressed: 1;
|
uint8_t buttonPressed: 1;
|
||||||
uint8_t buttonPressedLong: 1;
|
uint8_t buttonPressedLong: 1;
|
||||||
uint8_t m_buttonPressed: 1;
|
uint8_t m_buttonPressed: 2;
|
||||||
uint8_t m_buttonPressedLong: 1;
|
uint8_t m_buttonPressedLong: 1;
|
||||||
uint8_t ClrScr: 1;
|
uint8_t ClrScr: 1;
|
||||||
uint8_t Config: 1;
|
uint8_t Config: 1;
|
||||||
uint8_t WriteEEprom: 1;
|
uint8_t WriteEEprom: 1;
|
||||||
uint8_t Update: 1;
|
uint8_t Update: 1;
|
||||||
uint8_t CurMenue;
|
uint8_t CurMenue;
|
||||||
|
uint8_t SubMenue: 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Config
|
struct Config
|
||||||
{
|
{
|
||||||
uint8_t TRX; // TRX 1 oder 2 oder beide
|
uint8_t TRX: 2; // TRX 1 oder 2 oder beide
|
||||||
uint8_t IambicMode; // Iambic A oder Iambic B Mode
|
uint8_t KeyerMode: 2; // Iambic A, Iambic B oder Ultimatic
|
||||||
uint8_t Ratio; // Punkt/Strich Verhältnis
|
uint8_t SidetoneEnabled: 1; // Mithörton eingeschaltet
|
||||||
uint16_t FrequencySidetone; // Frequenz des Mithörtons
|
uint8_t WpMBpM: 1; // WpM oder BpM Anzeige
|
||||||
uint8_t SidetoneEnabled; // Mithörton eingeschaltet
|
uint8_t Reverse: 1; // linkes/rechtes Paddle vertauschen
|
||||||
uint8_t WpMBpM; // WpM oder BpM Anzeige
|
uint8_t WinkeyerEnabled: 1; // Winkeyer Emulation
|
||||||
|
uint8_t Ratio; // Punkt/Strich Verhältnis 1:3
|
||||||
|
uint8_t Memory:1; // Punkt/Strich Speicher
|
||||||
|
uint16_t SidetoneFreq; // Frequenz des Mithörtons
|
||||||
uint8_t WpM; // WpM
|
uint8_t WpM; // WpM
|
||||||
uint8_t Reverse; // linkes/rechtes Paddle vertauschen
|
|
||||||
uint8_t Weight; // ???
|
|
||||||
uint8_t RiseTime; // Anstiegszeit Sinuston
|
uint8_t RiseTime; // Anstiegszeit Sinuston
|
||||||
uint8_t RiseTimeCounter; // Anzahl Sinusschwingungen für den Anstieg
|
uint8_t RiseTimeCounter; // Anzahl Sinusschwingungen für den Anstieg
|
||||||
uint8_t DebounceTime; // Entprellzeit für Straight Key Eingang
|
uint8_t DebounceTime; // Entprellzeit für Straight Key Eingang
|
||||||
uint8_t WinkeyerEnabled; // Winkeyer2 Emulation
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Drehencoder
|
// Drehencoder
|
||||||
@ -155,18 +161,19 @@ volatile uint8_t EncoderTimer; // 10ms Timer for Encoder
|
|||||||
volatile int8_t EncoderCounter; // Vor/Rück Zähler
|
volatile int8_t EncoderCounter; // Vor/Rück Zähler
|
||||||
volatile int8_t EncoderPos; // Encoderposition für WpM/BpM
|
volatile int8_t EncoderPos; // Encoderposition für WpM/BpM
|
||||||
volatile int8_t EncoderPosConfig; // Encoderposition für Einstellungen
|
volatile int8_t EncoderPosConfig; // Encoderposition für Einstellungen
|
||||||
|
volatile int8_t EncoderPosSubConfig; // Encoderposition für Submenues
|
||||||
|
|
||||||
uint16_t StoreEEprom;
|
uint16_t StoreEEprom;
|
||||||
|
|
||||||
// Globale Variablen für diverse Zwecke
|
// Globale Variablen für diverse Zwecke
|
||||||
uint8_t WpM;
|
uint8_t WpM;
|
||||||
uint8_t Weight;
|
uint8_t Weight;
|
||||||
uint8_t t_element_length;
|
uint8_t LengthOfElement;
|
||||||
|
|
||||||
// Diverse Zähler für Timer 0
|
// Diverse Zähler für Timer 0
|
||||||
uint16_t MenuCtrlTimer; // Wartezeit bis zur Betriebsanzeige nach Config
|
uint16_t MenuCtrlTimer; // Wartezeit bis zur Betriebsanzeige nach Config
|
||||||
volatile uint16_t t_delayms; // Timer 0 max. 65535ms, all purpose timer variable
|
volatile uint16_t t_delayms; // Timer 0 max. 65535ms, all purpose timer variable
|
||||||
volatile uint16_t mselement; // Timer 0 max. 65535ms, element length of dit or dah
|
volatile uint16_t t_elementlength; // Timer 0 max. 65535ms, element length of dit or dah
|
||||||
|
|
||||||
// State Machines
|
// State Machines
|
||||||
uint8_t PaddleMode;
|
uint8_t PaddleMode;
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
/** \brief BJ-Keyer
|
/** @brief BJ-Keyer
|
||||||
|
|
||||||
:
|
Morsekeyer von DL7BJ
|
||||||
Morsekeyer von DL7BJ
|
tom@dl7bj.de
|
||||||
tom@dl7bj.de
|
|
||||||
|
|
||||||
OLED functions from https://github.com/Sylaina/oled-display
|
OLED functions from https://github.com/Sylaina/oled-display
|
||||||
|
|
||||||
@verbatim
|
@verbatim
|
||||||
History
|
History
|
||||||
@ -19,6 +18,7 @@
|
|||||||
2022-09-11 DL7BJ Encoder, LC-Display, Frontplatine "entsorgt"
|
2022-09-11 DL7BJ Encoder, LC-Display, Frontplatine "entsorgt"
|
||||||
2023-06-28 DL7BJ Port Anpassungen an neue Leiterplatte V1.01
|
2023-06-28 DL7BJ Port Anpassungen an neue Leiterplatte V1.01
|
||||||
2023-07-29 DL7BJ Menü für Einstellungen implementiert
|
2023-07-29 DL7BJ Menü für Einstellungen implementiert
|
||||||
|
2023-08-06 DL7BJ Quelltexte umstrukturiert, Aufteilung
|
||||||
|
|
||||||
ATMEGA328(P)
|
ATMEGA328(P)
|
||||||
----------
|
----------
|
||||||
@ -158,9 +158,10 @@ void Init()
|
|||||||
cbi(PORTD,RIGHT_PADDLE);
|
cbi(PORTD,RIGHT_PADDLE);
|
||||||
cbi(PORTD,STRAIGHT_KEY);
|
cbi(PORTD,STRAIGHT_KEY);
|
||||||
|
|
||||||
t_element_length = (uint16_t)1200/bConfig.WpM;
|
LengthOfElement = (uint16_t)1200/bConfig.WpM;
|
||||||
|
|
||||||
// Pin Change Interrupts Port D - Keys
|
// Pin Change Interrupts Port D - Keys
|
||||||
|
// Alle Pins liegen im PCINT2 Vektor
|
||||||
// PD4 - StraightKey - PCINT20 - Pin Change Interrupt 20
|
// PD4 - StraightKey - PCINT20 - Pin Change Interrupt 20
|
||||||
// PD3 - Right Paddle - PCINT19 - Pin Change Interrupt 19
|
// PD3 - Right Paddle - PCINT19 - Pin Change Interrupt 19
|
||||||
// PD2 - Left Paddle - PCINT18 - Pin Change Interrupt 18
|
// PD2 - Left Paddle - PCINT18 - Pin Change Interrupt 18
|
||||||
@ -185,14 +186,12 @@ void Init()
|
|||||||
bMenuCtrl.Update = 1;
|
bMenuCtrl.Update = 1;
|
||||||
bMenuCtrl.Config = 0;
|
bMenuCtrl.Config = 0;
|
||||||
bMenuCtrl.buttonPressed = 0;
|
bMenuCtrl.buttonPressed = 0;
|
||||||
bMenuCtrl.WriteEEprom = 0;
|
|
||||||
bMenuCtrl.buttonPressedLong = 0;
|
bMenuCtrl.buttonPressedLong = 0;
|
||||||
// Initialisierung Konfiguration
|
// Initialisierung Konfiguration
|
||||||
bConfig.IambicMode = 1;
|
bConfig.KeyerMode = IAMBIC_A;
|
||||||
bConfig.FrequencySidetone = 600;
|
bConfig.SidetoneFreq = 600;
|
||||||
bConfig.SidetoneEnabled = 1;
|
bConfig.SidetoneEnabled = 1;
|
||||||
bConfig.TRX = 0;
|
bConfig.TRX = 0;
|
||||||
bConfig.Weight = 50;
|
|
||||||
bConfig.WpMBpM = 1;
|
bConfig.WpMBpM = 1;
|
||||||
bConfig.WpM = 12;
|
bConfig.WpM = 12;
|
||||||
bConfig.Ratio = 30;
|
bConfig.Ratio = 30;
|
||||||
@ -242,23 +241,26 @@ ISR(TIMER1_COMPA_vect)
|
|||||||
|
|
||||||
/** @brief 8 Bit Timer 0 ISR routine
|
/** @brief 8 Bit Timer 0 ISR routine
|
||||||
*
|
*
|
||||||
* The Timer 0 CTC interrupt will be fired every millisecond
|
* The Timer 0 CTC interrupt will be fired every millisecond and
|
||||||
|
* has a bundle of counter variables for different timings.
|
||||||
|
*
|
||||||
|
* params: none
|
||||||
|
* return: none
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
ISR(TIMER0_COMPA_vect)
|
ISR(TIMER0_COMPA_vect)
|
||||||
{
|
{
|
||||||
t_delayms++; // 16Bit counter for milliseconds
|
t_delayms++; // 16Bit counter for milliseconds
|
||||||
|
t_elementlength++; // Length of element dit/dah
|
||||||
|
t_wait++;
|
||||||
|
t_timer++;
|
||||||
StoreEEprom++; // Zähler für Zeitablauf speichern EEprom
|
StoreEEprom++; // Zähler für Zeitablauf speichern EEprom
|
||||||
MenuCtrlTimer++; // Zähler für Zeitablauf Einstellungen
|
MenuCtrlTimer++; // Zähler für Zeitablauf Einstellungen
|
||||||
EncoderTimer++; // Zähler für 5ms Drehencoder Timer
|
EncoderTimer++; // Zähler für 5ms Drehencoder Timer
|
||||||
|
|
||||||
mselement++; // element length of dit or dat
|
if(t_timer >= L_WAIT)
|
||||||
t_wait++;
|
|
||||||
l_timer++;
|
|
||||||
|
|
||||||
if(l_timer >= L_WAIT)
|
|
||||||
{
|
{
|
||||||
l_timer = 0;
|
t_timer = 0;
|
||||||
}
|
}
|
||||||
// Alle 5ms den Drehencoder abfragen
|
// Alle 5ms den Drehencoder abfragen
|
||||||
if(EncoderTimer > 5)
|
if(EncoderTimer > 5)
|
||||||
@ -270,15 +272,15 @@ ISR(TIMER0_COMPA_vect)
|
|||||||
if(lastButton == ButtonPressed_Short)
|
if(lastButton == ButtonPressed_Short)
|
||||||
{
|
{
|
||||||
bMenuCtrl.buttonPressed = 1;
|
bMenuCtrl.buttonPressed = 1;
|
||||||
SendSerialString("Encoder Button pressed short\r\n");
|
|
||||||
}
|
}
|
||||||
if(lastButton == ButtonPressed_Long)
|
if(lastButton == ButtonPressed_Long)
|
||||||
{
|
{
|
||||||
bMenuCtrl.buttonPressedLong = 1;
|
bMenuCtrl.buttonPressedLong = 1;
|
||||||
SendSerialString("Encoder Button pressed long\r\n");
|
if(bMenuCtrl.Config == 1)
|
||||||
|
bMerker.WriteEEprom = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// WpM verändert? Nach einer Sekunde im EEPROM Speichern
|
// WpM verändert? Nach 5 Sekunden im EEPROM Speichern
|
||||||
if((StoreEEprom > 1000) && (bMerker.WpMChanged))
|
if((StoreEEprom > 1000) && (bMerker.WpMChanged))
|
||||||
{
|
{
|
||||||
bMerker.WriteWpMEEprom = 1;
|
bMerker.WriteWpMEEprom = 1;
|
||||||
@ -319,9 +321,8 @@ ISR(USART_RX_vect)
|
|||||||
{
|
{
|
||||||
unsigned char data;
|
unsigned char data;
|
||||||
data = UDR0;
|
data = UDR0;
|
||||||
SendSerialChar(data);
|
SerialWriteChar(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** DoMorse
|
** DoMorse
|
||||||
*/
|
*/
|
||||||
@ -366,35 +367,34 @@ void DoMorse(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** @brief Initialisierung bei Reset und Neustart
|
||||||
|
* @param none
|
||||||
|
* @return none
|
||||||
|
*/
|
||||||
void ReStart(void)
|
void ReStart(void)
|
||||||
{
|
{
|
||||||
ReadEEpromWpM();
|
ReadEEprom();
|
||||||
WpM = bConfig.WpM;
|
WpM = bConfig.WpM;
|
||||||
EncoderPos = bConfig.WpM;
|
EncoderPos = bConfig.WpM;
|
||||||
EncoderWrite(bConfig.WpM);
|
EncoderWrite(bConfig.WpM);
|
||||||
EncoderPosConfig = 1;
|
EncoderPosConfig = 1;
|
||||||
SetFrequency(600);
|
SetFrequency(bConfig.SidetoneFreq);
|
||||||
MenuCtrlTimer = 0;
|
MenuCtrlTimer = 0;
|
||||||
t_delayms = 0;
|
t_delayms = 0;
|
||||||
SendStatus = SENDING_NOTHING;
|
SendStatus = SENDING_NOTHING;
|
||||||
WpM = 15;
|
|
||||||
Weight = 50;
|
|
||||||
Init();
|
Init();
|
||||||
DisplayVersion();
|
DisplayVersion();
|
||||||
KeyerMode = IAMBIC_A;
|
KeyerMode = bConfig.KeyerMode;
|
||||||
PaddleMode = PADDLE_NORMAL;
|
PaddleMode = bConfig.Reverse;
|
||||||
KeyTX = 1;
|
KeyTX = 1;
|
||||||
KeyState = 0;
|
KeyState = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/** @brief main()
|
||||||
/*
|
* @param none
|
||||||
** main
|
* @return none
|
||||||
*/
|
*/
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
uint8_t c = 0;
|
|
||||||
ReStart();
|
ReStart();
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
@ -403,10 +403,18 @@ int main(void)
|
|||||||
// dann im EEprom speichern und Merker löschen.
|
// dann im EEprom speichern und Merker löschen.
|
||||||
if(bMerker.WriteWpMEEprom)
|
if(bMerker.WriteWpMEEprom)
|
||||||
{
|
{
|
||||||
sprintf(" %i WpM in EEprom speichern\r\n", bConfig.WpM);
|
sprintf(sdebug," %i WpM in EEprom speichern\r\n", bConfig.WpM);
|
||||||
|
SerialWriteString(sdebug);
|
||||||
WriteEEpromWpM();
|
WriteEEpromWpM();
|
||||||
bMerker.WriteWpMEEprom = 0;
|
bMerker.WriteWpMEEprom = 0;
|
||||||
}
|
}
|
||||||
|
if(bMerker.WriteEEprom)
|
||||||
|
{
|
||||||
|
sprintf(sdebug,"Einstellungen in EEprom speichern\r\n");
|
||||||
|
SerialWriteString(sdebug);
|
||||||
|
WriteEEprom();
|
||||||
|
bMerker.WriteEEprom = 0;
|
||||||
|
}
|
||||||
UpdateDisplay();
|
UpdateDisplay();
|
||||||
CheckStraightKey();
|
CheckStraightKey();
|
||||||
CheckPaddles();
|
CheckPaddles();
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "encoder.h"
|
#include "encoder.h"
|
||||||
#include "functions.h"
|
#include "functions.h"
|
||||||
|
#include "controls.h"
|
||||||
|
|
||||||
struct Config bConfig;
|
struct Config bConfig;
|
||||||
struct MenuCtrl bMenuCtrl;
|
struct MenuCtrl bMenuCtrl;
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren