die auf einer Platine platzsparend unterzubringen. Deswegen nutze ich 2x 74HC595 und 2x Pins vom PortC Register. Die Ausgänge des ersten Registers liegen über 510 Ohm Widerstände an den Anode der Segment LED an. Q0 bis Q6 sind dabei für die einzeln Segmente und Q7 ist für den Dot Punkt. Das zweite
clock für PortA SCL pin RCC_AHB1PeriphClockCmd(I2C_PERIPH_SDA_PORT, ENABLE); // Enable clock für PortC SDA pin I2C_Cmd(I2C_CHANNEL, DISABLE); // I2C abschalten, damit Bus still bleibt // Port mit SCL einrichten GPIO_InitStruct.GPIO_Pin = I2C_SCL_PIN; // Pin A8 (I2C3_SCL) GPIO_InitStruct.GPIO_Mode =
As Integer Dim B As Single Dim C As Single Dim D As Integer Dim Rechnen As Integer Config Portc.3 = Output Roteled Alias Portc.3 Config Portb.0 = Output Rotled1 Alias Portb.0 Config Portb.1 = Output Rotled2 Alias Portb.1 Config Portb.2 = Output Rotled3 Alias Portb.2 Config Portb.3 =
Bisschen planlos... Du hast Pinc.0 als Eingang definiert und auch den Pullup mit Portc.0=1 eingeschltet. Der Taster muß nun zwischen Pinc.0 und Masse und Du mußt auf "0" auswerten, denn der Pin wird dann bei Tastendruck auf GND d.h 0 gezogen. Das eigentliche Programm ist mir zu
the SWDTEN bit) WDTPS 32768 Watchdog Timer Postscale Select bits 1:32768 300005 CONFIG3H 83 CCP2MX PORTC CCP2 MUX bit CCP2 input/output is multiplexed with RC1 PBADEN ON PORTB A/D Enable bit PORTB<4:0> pins are configured as analog input channels on Reset LPT1OSC OFF Low-Power Timer1 Oscillator Enable
the SWDTEN bit) WDTPS 32768 Watchdog Timer Postscale Select bits 1:32768 300005 CONFIG3H 83 CCP2MX PORTC CCP2 MUX bit CCP2 input/output is multiplexed with RC1 PBADEN ON PORTB A/D Enable bit PORTB<4:0> pins are configured as analog input channels on Reset LPT1OSC OFF Low-Power Timer1 Oscillator Enable
gern in einer for-Schleife die Ports beschreiben. Also mit [c] i=0 PORTA |= (....); i=1 PORTC |= (....); i=2 PORTD |= (....); ... [/c] Der Übersichtlichkeit halber habe ich die entsprechenden Ports definiert als [c] #define CC0 PORTA #define CC1 PORTC #define CC2 PORTD ...
ich bastle gerade etwas [...] in c++ herum. [c] volatile uint8_t *portList[] = { PORTA, PORTB, PORTC, ... }; int i = 0; for(const uint8_t * &port: portList) { port = prop.getRow(i++); } [/c]
: [c] //Set pull-ups for inputs active = 1, disabled = 0 (default) PORTB |= 0b00000000; PORTC |= 0b00000000; PORTD |= 0b00000000; [/c] Durch eine Oder-Verknüpfung kannst du kein Bit auf 0 bringen. Es ist nicht verwerflich, in der ersten Anweisung eine harte Zuweisung mit "=" zu machen.
USART_TXEN_bm | USART_RXEN_bm; // activated RX and TX USARTC1.CTRLC = USART_CHSIZE_8BIT_gc; // 8 Bit PORTC.DIR |= (1<<7); // TXD is output PORTC.DIR &= ~(1<<6); #elif defined (_CHIBIOS_HAL_) // we use the SD interface for logging, no need to init that here #else #if (IRMP_EXT_LOGGING == 0) // use UART UART0
USART_TXEN_bm | USART_RXEN_bm; // activated RX and TX USARTC1.CTRLC = USART_CHSIZE_8BIT_gc; // 8 Bit PORTC.DIR |= (1<<7); // TXD is output PORTC.DIR &= ~(1<<6); #elif defined (_CHIBIOS_HAL_) // we use the SD interface for logging, no need to init that here #else #if (IRMP_EXT_LOGGING == 0) // use UART UART0
Jedenfalls steht im Programm dann irgendwas wie: [c] ... = PORTD; [/c] oder [c] ... = PORTC; [/c] oder ähnlich je nachdem wo Deine Taster angeschlossen sind. Richtig? Es könnte auch: [c] ... = PORTD; ... = PORTC; [/c] Wenn die Taster an unterschiedlichen Ports angeschlossen
PC5 ausgeben if (PINB & (1 << 0)) { // pin is high PORTC |= (1 << 5); } else { // pin is low PORTC &= ~(1 << 5); } // Blinken der LED 2 (rot) an Pin PC0 unter Verwendung der
IRMP_EXT_LOGGING == 1 // use external logging # include "irmpextlog.h" @@ -906,6 +910,9 @@ irmp_uart_init (void) PORTC.DIR |= (1<<7); // TXD is output PORTC.DIR &= ~(1<<6); +#elif defined (_CHIBIOS_HAL_) + // we use the SD interface for logging, no need to init that here + #else #if (IRMP_EXT_LOGGING == 0) // use UART
, Byval Oled_row As Byte) Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
, Byval Oled_row As Byte) Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
atmega328 möchte ich ein Testgerät bauen und mit dem internen ADC 2 verschiedene Spannungen messen (PORTC0 / ADC0) + (PORTC1 / ADC1). An die restlichen Pins des ADC-Ports (Port C) möchte ich zwei LEDs und ein Schieberegister 74HC165 hängen. Nun bin ich mir unsicher bei der Auswahl der Induktivität
, Byval Oled_row As Byte) Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
, Byval Oled_row As Byte) Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
Byte, ByVal oled_row As Byte) Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
Declare Sub Messtransform 'Declare Sub Messtransform(byref Ip As Word , Byref Op As Word) Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Const Oled_write_address = &H78 'Adresse des I2C Displays Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler
Declare Sub Messtransform 'Declare Sub Messtransform(byref Ip As Word , Byref Op As Word) Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Const Oled_write_address = &H78 'Adresse des I2C Displays Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler
Byte, ByVal oled_row As Byte) Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
Function read_UART() As Byte Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
Function Read_uart() As Byte Const Oled_write_address = &H78 'Adresse des I2C Displays Config Scl = Portc.5 Config Sda = Portc.4 Contrast_wert = &H00 'Contrast von 00 bis FF I2cinit Dim Schleife As Dword Schleife = 1 Config Adc = Single , Prescaler = 128 , Reference = Internal Start Adc Dim Ip As Word
modulation output with varying duty cycle on channel A. 1. Configure PC0 for output by setting bit 0 in PORTC.DIR. 2. Select the timer period by setting the PER[H:L] register. 3. Select a waveform generation mode by setting the WGMODE[2:0] bits in 4. Enable Compare Channel A by setting the CCAEN bit in