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
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
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
) verdient besondere Beachtung: Wenn sie eingeschaltet ist, ist auf einem bestimmten Port (z. B. PORTC beim ATMega32) die JTAG-Unterstützung aktiviert. Dann funktionieren vier Bits dieses Ports nicht wie gewohnt, da sie für die JTAG-Schnittstelle reserviert werden. In dem zum STK500 gehörenden Entwicklungstool
Prozessor keine gültige Rücksprungadresse vom Stack holen kann. Außerdem funktionieren einige IO-Pins an PORTC, PORTF und PORTG anders. Für weitere Infos bzgl. TWI, UART, Timer, Bootloader und Kalibrierung des internen RC-Oszillators unbedingt das Datenblatt lesen. Lötstellen. "Kalte", d. h. schlechte Lötstellen
Pins bit 5 .equ PINB6 = 6 ; Port B Input Pins bit 6 .equ PINB7 = 7 ; Port B Input Pins bit 7 ; ***** PORTC ************************ ; PORTC - Port C Data Register .equ PORTC0 = 0 ; Port C Data Register bit 0 .equ PC0 = 0 ; For compatibility .equ PORTC1 = 1 ; Port C Data Register bit 1 .equ PC1 = 1 ; For compatibility .equ PORTC2 = 2 ; Port C Data Register bit 2 .equ PC2 = 2 ; For compatibility .equ PORTC3 = 3 ; Port C Data Register bit 3 .equ PC3 = 3 ; For compatibility .equ PORTC4 = 4 ; Port C Data Register bit 4 .equ PC4
Pins bit 5 .equ PINB6 = 6 ; Port B Input Pins bit 6 .equ PINB7 = 7 ; Port B Input Pins bit 7 ; ***** PORTC ************************ ; PORTC - Port C Data Register .equ PORTC0 = 0 ; Port C Data Register bit 0 .equ PC0 = 0 ; For compatibility .equ PORTC1 = 1 ; Port C Data Register bit 1 .equ PC1 = 1 ; For compatibility .equ PORTC2 = 2 ; Port C Data Register bit 2 .equ PC2 = 2 ; For compatibility .equ PORTC3 = 3 ; Port C Data Register bit 3 .equ PC3 = 3 ; For compatibility .equ PORTC4 = 4 ; Port C Data Register bit 4 .equ PC4
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
Pins bit 5 .equ PINB6 = 6 ; Port B Input Pins bit 6 .equ PINB7 = 7 ; Port B Input Pins bit 7 ; ***** PORTC ************************ ; PORTC - Port C Data Register .equ PORTC0 = 0 ; Port C Data Register bit 0 .equ PC0 = 0 ; For compatibility .equ PORTC1 = 1 ; Port C Data Register bit 1 .equ PC1 = 1 ; For compatibility .equ PORTC2 = 2 ; Port C Data Register bit 2 .equ PC2 = 2 ; For compatibility .equ PORTC3 = 3 ; Port C Data Register bit 3 .equ PC3 = 3 ; For compatibility .equ PORTC4 = 4 ; Port C Data Register bit 4 .equ PC4
Pins bit 5 .equ PINB6 = 6 ; Port B Input Pins bit 6 .equ PINB7 = 7 ; Port B Input Pins bit 7 ; ***** PORTC ************************ ; PORTC - Port C Data Register .equ PORTC0 = 0 ; Port C Data Register bit 0 .equ PC0 = 0 ; For compatibility .equ PORTC1 = 1 ; Port C Data Register bit 1 .equ PC1 = 1 ; For compatibility .equ PORTC2 = 2 ; Port C Data Register bit 2 .equ PC2 = 2 ; For compatibility .equ PORTC3 = 3 ; Port C Data Register bit 3 .equ PC3 = 3 ; For compatibility .equ PORTC4 = 4 ; Port C Data Register bit 4 .equ PC4
Pins bit 5 .equ PINB6 = 6 ; Port B Input Pins bit 6 .equ PINB7 = 7 ; Port B Input Pins bit 7 ; ***** PORTC ************************ ; PORTC - Port C Data Register .equ PORTC0 = 0 ; Port C Data Register bit 0 .equ PC0 = 0 ; For compatibility .equ PORTC1 = 1 ; Port C Data Register bit 1 .equ PC1 = 1 ; For compatibility .equ PORTC2 = 2 ; Port C Data Register bit 2 .equ PC2 = 2 ; For compatibility .equ PORTC3 = 3 ; Port C Data Register bit 3 .equ PC3 = 3 ; For compatibility .equ PORTC4 = 4 ; Port C Data Register bit 4 .equ PC4
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 Word Schleife = 1 Config Adc = Single , Prescaler
falsch ?? Im Anschluss noch das Programm. Gruß Karl-Heinz // Define #define LED1 PORTC.RC5 //LED low liegt an Port RC5 // Globale Variablen int analog_hexwert; void main(void) { TRISC = 0x07; //set C-Port 0-2 in 3-5 out PORTC = 0x00; //set C-Port all bit
nach den Senden, mit einem 3ten Portpin. Wie geht den das? Zur zeit mache ich noch: [code] PORTC |= (1 << PC4); delay_ms (1); sendecode(werte); delay_ms(1); PORTC &= ~(1 << PC4); [/code] Gruß Paul
Paul J. schrieb im Beitrag #5489069: > Zur zeit mache ich noch: > PORTC |= (1 << PC4); > delay_ms (1); > sendecode(werte); > delay_ms(1); > PORTC &= ~(1 << PC4); Wenn es funktionert, warum nicht. Wir kennen Deinen Sender nicht, wissen also nicht, welche Vorlauf
PMIC_RREN_bm; Der TX-Port als Ausgang, Hi: #define TX_PIN 3 // (für USARTC1: 7 einsetzen) PORTC.OUTSET=1<<TX_PIN; PORTC.DIRSET=1<<TX_PIN; Wir kriegen das zum Laufen, auch wenn hier einer immer dazwischen labert. mfg Achim
meinem Terminal "h-term" das ich wie im Bild eingestellt habe. verdrahtet habe ich es so von PortC PC3----> TX Cp210x von Portc PC2----> Rx Cp210x mein Problem ist jetzt das nichts gesendet wird bzw. im Terminal wird mir nichts angezeigt habe ich hier etwas falsch gemacht?? [c]/* * Hallo_Welt.c
Converter Cp210X Was für Pegel gibt der aus? RS232 oder TTL? > verdrahtet habe ich es so > von PortC PC3----> TX Cp210x > von Portc PC2----> Rx Cp210x Brauchst du da zwischen uC und USB Adapter evtl. einen MAX232 Pegelwandler? Michael H. schrieb im Beitrag #5477216: > das ist auch, wenn ich
Leerlauf i um 1 reduzieren } } int main(void) { unsigned char input; DDRC = 0x00; // Port C is Input PORTC = 0xff; // Port C is "high" <-- pull-ups aktiv DDRB = 0xff; // Port B is Output PORTB = 0x00; // Port B is 'low DDRD = 0xff; // Port D is Output PORTD = 0x00; // Port D is "low" init_timer0(); init_timer1
delay_milliseconds(15); } } } int main(void) { unsigned char input; DDRC = 0x00; // Port C is Input PORTC = 0xff; // Port C is "high" <-- pull-ups aktiv DDRB = 0xff; // Port B is Output PORTB = 0x00; // Port B is 'low DDRD = 0xff; // Port D is Output PORTD = 0x00; // Port D is "low" init_timer0(); init_timer1
(4); } } int main(void) { unsigned char input; unsigned int time; DDRC = 0x00; // Port C is Input PORTC = 0xff; // Port C is "high" <-- pull-ups aktiv DDRB = 0xff; // Port B is Output PORTB = 0x00; // Port B is 'low DDRD = 0xff; // Port D is Output PORTD = 0x00; // Port D is "low" init_timer0(); init_timer1
main(void) { unsigned char input; unsigned int time; ICR1 = 255; DDRC = 0x00; // Port C is Input PORTC = 0xff; // Port C is "high" <-- pull-ups aktiv DDRB = 0xff; // Port B is Output PORTB = 0x00; // Port B is 'low DDRD = 0xff; // Port D is Output PORTD = 0x00; // Port D is "low" init_timer0(); init_timer1
(4); } } int main(void) { unsigned char input; unsigned int time; DDRC = 0x00; // Port C is Input PORTC = 0xff; // Port C is "high" <-- pull-ups aktiv DDRB = 0xff; // Port B is Output PORTB = 0x00; // Port B is 'low DDRD = 0xff; // Port D is Output PORTD = 0x00; // Port D is "low" init_timer0(); init_timer1
main(void) { unsigned char input; unsigned int time; ICR1 = 255; DDRC = 0x00; // Port C is Input PORTC = 0xff; // Port C is "high" <-- pull-ups aktiv DDRB = 0xff; // Port B is Output PORTB = 0x00; // Port B is 'low DDRD = 0xff; // Port D is Output PORTD = 0x00; // Port D is "low" init_timer0(); init_timer1
main(void) { unsigned char input; unsigned int time; ICR1 = 255; DDRC = 0x00; // Port C is Input PORTC = 0xff; // Port C is "high" <-- pull-ups aktiv DDRB = 0xff; // Port B is Output PORTB = 0x00; // Port B is 'low DDRD = 0xff; // Port D is Output PORTD = 0x00; // Port D is "low" init_timer0(); init_timer1
Aber ich hätte da noch ein paar Fragen: Wenn Laut Sensor VOUT das Bit 7 ist, dann ist das doch PORTC.7 oder? Das Gleiche dann für VIN: Bit 4 ist dann PORTC.4? Wie genau muss ich dann PORTC oder DDRC definieren? Eingänge sind 0 und Ausgänge sind 1, also würde das dann bedeuten 0b01111111 also 0x7F
macht es einfacher, dass später vielleicht mal auf einen anderen Port/Pin zu schieben. #define VIN PORTC.4 . VIN=0; . VIN=1; Entweder falsch gedacht oder nur der Kommentar falsch? >PORTC.4=0; //VIN auf high Das ist auf jeden Fall falsch: >wert=r_rotate(PORTC.7); //
kein Java auf dem kleinen Knecht. Ja stimmt schon, wenn das so läuft wie beim Arduino und mit PortC = B10010101 die Pins PC7, PC4, PC2 und PC0 auf High gestellt werden, dann ist das mit einem 4-8-12 Bit integer schon ein bisschen kuhler/eleganter. Allerdings auch anfangs etwas schwerer zu verstehen
richtigen Bezeichner verwenden, damit der Compiler eine Chance hat. Hier mal ein schlechtes Beispiel: PORTC |= (1<<PB7) Der Kompiler ist still! So musses: PORTC |= (1<<PC7) Der Kompiler schreit Wolfgang schrieb im Beitrag #5427755: > außer dass es ein > Namensteil ist, der genauso gut auch MEINPORTBIT
nicht, denn dazwischen liegt noch eine Funktion mit einem Argument einer Modulo-Operation. > PORTC |= (1<<SIGNAL_ON_LED); > _delay_us(time_on); > PORTB &= ~(1<<DIGIT1); > SevenSegment(minute%10); > PORTC &= ~(1<<SIGNAL_ON_LED); >Anbei ein Auszug aus der gekürzten mux_display Funktion
Hi, Vielleicht einfach auch nur der Klassiker: PortC = JTAG, JTAG ist in den Fuses an und deswegen gehen die IO-Befehle in die Hose... Probiert mal D9 als HFuse.
Verwirrter schrieb im Beitrag #5408361: > if((PORTC & (1 << PC5)) == 0) > { > led_3 = 1; > }else led_3 = 0; Würde ich ersetzen durch: > led_3 = !(PORTC & (1 << PC5)); Und das für alle Inputs. Ansonsten ....