-
Datei
gclcd.h
SSPCON1.4 #bit SSPEN = SSPCON1.5 #byte SSPBUF = 0xFC9 #byte PORTA = 0xF80 #bit CS = PORTA.5 #byte PORTC = 0xF82 #bit RST = PORTC.0 #bit SCK = PORTC.3 #bit SDO = PORTC.5 #byte TRISA = 0xF92 #bit SET_CS = PORTA.5 #byte TRISC = 0xF94 #bit SET_RST = PORTC.0 #bit SET_SCK = PORTC.3 #bit SET_SDO = PORTC.5 void
-
Datei
WordClock.c
; volatile uint16_t data[10]; void wordclock(){ for(row = 1; row <= 6; row++){ PORTB &= ~(1<<ss); PORTC = 0xFF; // _delay_ms(2); for (i = 0; i < 8; i++){ PORTB |= (1<<clock); if( (data[row]) & (1 << i) ){ PORTB |= (1<<dout); }else{ PORTB &= ~(1<<dout); } PORTB &= ~(1<<clock); } for (i = 0; i < 9; i++
in „Genaue Sekunde AVR“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
WordClock.c
DEBOUNCE; /* kurze Periode */ } void wordclock(){ for(row = 1; row <= 6; row++){ PORTB &= ~(1<<ss); PORTC = 0xFF; // _delay_ms(2); for (i = 0; i < 8; i++){ PORTB |= (1<<clock); if( (data[row]) & (1 << i) ){ PORTB |= (1<<dout); }else{ PORTB &= ~(1<<dout); } PORTB &= ~(1<<clock); } for (i = 0; i < 9; i++
in „Genaue Sekunde AVR“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
WordClock.c
=60) m=0; if(aflag == 1) {assign(); aflag = 0;} for(row = 1; row <= 6; row++){ PORTB &= ~(1<<ss); PORTC = 0xFF; // _delay_ms(2); for (i = 0; i < 8; i++){ PORTB |= (1<<clock); if( (data[row]) & (1 << i) ){ PORTB |= (1<<dout); }else{ PORTB &= ~(1<<dout); } PORTB &= ~(1<<clock); } for (i = 0; i < 9; i++
in „Genaue Sekunde AVR“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.c
********************************/ void hw_init( void ) { /* configure PORTD */ DDRD = 0b00000000; PORTC = 0b00000000; /* configure PORTB */ DDRB = 0b00000000; PORTB = 0b00000000; /* configure PORTC */ DDRC = 0b00000111; PORTC = 0b00000000; set_sleep_mode( SLEEP_MODE_IDLE ); /* initialize and start ms
in „AVR ATmega168 - Probleme mit Interrupt bei UART Empfang“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Servotest_AT32.bas
Servo2 = Portb.1 , Reload = 10 Config Portb = Output Config Portd = Output Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.3 , Rs = Portc.2 Config Lcd = 16 * 2 Cursor Off Noblink Cls Dim I As Byte Dim J As Byte Enable Interrupts Servo(1) = 20 Servo(2) = 90 Locate
in „Servomotor ansteuern in Bascom“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
slave.txt
|= (1<<SPE) | (1<<SPIE) | (1<<SPR0) ; } void knight1(void) { int x = 200; for (int i=1;i<2;i++) { PORTC = 0b11111110; _delay_ms(x); PORTC = 0b11111101; _delay_ms(x); PORTC = 0b11111011; _delay_ms(x); PORTC = 0b11110111; _delay_ms(x); PORTC = 0b11111011; _delay_ms(x); PORTC = 0b11111101; _delay_ms(x);
in „Problem: SPI daten von mehreren slaves zum master! aber wie?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
smsrec4.bas
200 Dim Z As Integer Dim Y As Integer Dim B As String * 1 Dim A As Byte Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.4 , Rs = Portc.5 Config Lcd = 20 * 4 Echo Off 'Enable Interrupts Print "at+cmgf=1" Waitms 300 Hauptprg: Wait 4 Cls Lcd "HauptProgramm"
in „Nokia SMS mit Mikrocontroller auslesen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Praeambel-Empfang.bas
On Timer1 Timer_irq On Int1 On_int1 Config Pind.3 = Input Portd.3 = 1 Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0 Config Lcd = 16 * 2 Do Cls Locate 1 , 1 Lcd Bin(datar) 'Ausgabe der empfangenen Daten 'Wenn die Präambel von 00000001
in „Funkprotokoll dekodieren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Praeambel-Empfang.bas
On Timer1 Timer_irq On Int1 On_int1 Config Pind.3 = Input Portd.3 = 1 Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0 Config Lcd = 16 * 2 Do Cls Locate 1 , 1 Lcd Bin(datar) 'Ausgabe der empfangenen Daten 'Wenn die Präambel von 00000001
in „Funkprotokoll dekodieren“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
blub.txt
servo_currentcount = 0; } //if (servo_currentcount < 59) if (servo_currentcount < rec_servo_1) { if (!(PORTC = 0b00000001)) { PORTC = 0b00000001; } } else { if (!(PORTC = 0b00000000)) { PORTC = 0b00000000; } } //Empfänger Kanal 1 auswerten if (PINA & 1) { rec_count_servo_1 +=1; } else { if ((rec_count_servo
in „RC Empfänger auslesen, kein konstanter Wert“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
DisplayAnsteuerung.txt
loop_until_bit_is_set(PIND,7); set_e(0); } void set_e(char status) /* PORT C0 = Pin 6 am LCD */ { if(status) sbi(PORTC,3); else cbi(PORTC,3); } void set_rw(char status) { if(status) sbi(PORTC,4); else cbi(PORTC,4); } void set_rs(char status) { if(status) sbi(PORTC,5); else cbi(PORTC,5); } void init(void) { //busyflag
in „LCD162C Ansteuerung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.cpp
//------------------------------------ { DDRA = 0b11111111; //PORTA Eingang DDRC = 0b00000000; //PORTC Ausgang DDRD |= (1<<PD3); //PD3 Eingang PORTA = 0b11111111; //PORTA Pullup PORTC = 0b11111111; //PORTC Einschalten PORTD |= (1<<PD3); //PD3 Pullup prio_active = true; _delay_ms(1000); } //---------
in „Atmega64A Funktionsproblem“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.c
K2Settings = bit_clear_K2(0b01000000, K2Settings); K2Settings = bit_clear_K2(0b10000000, K2Settings); PORTC = 0x00; // Lösche PORTC PORTD = 0x00; // Lösche PORTD } void peripherie_LED(void) { K2Settings = bit_clear_K2(0b00000001, K2Settings); TRISC = 0x00; PORTC = 0x00; } void peripherie_NoLED(void) { K2Settings
in „PIC16F887 auf MC2V0 - I2C“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.c
; } else { PORTD &= ~(1<<pinD0); } */ PORTD = data; } void writeDisp(uint8_t data, uint8_t cmd) { PORTC &= ~(1<<pinRW) | (1<<pinCS) | (1<<pinDC); // lösche Bit R/W, /CS und D/C _delay_us(100); // wenn COMMAND if (cmd == 1) { // lösche Bit DC PORTC &= ~(1<<pinDC); } else { PORTC |= (1<<pinDC); } setData(data); PORTC |= (1<<pinE); // setze Bit E _delay_us(100); PORTC &= ~(1<<pinE); _delay_us(100); PORTC |= (1<<pinRW); PORTC |= (1<<pinDC); _delay_us(100); } void initalize() { _delay_ms(10); PORTC &= ~(1<<pinRES)
in „AVR Mega1284, Fontarray zu groß -> wie in Flash?“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ATMega8-UART.c
_ 1 #define OSCSPEED 8000000 /* in Hz */ #include "avr/io.h" void Initialize(void) { PORTB = 0x0; PORTC = 1<<5; /* turn the LED off */ PORTD = 0x0; DDRB = 0x0; DDRC = 1<<5; /* PC5 as output - the LED is there */ DDRD = 0x0; } void InitUART(uint32_t baud) /* here a simple int will not suffice*/ { int
in „Gesucht: How-To für ATMega8 und UART (Olimex P28)“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
komplette_Beschreibung.txt
& (1 << PB1)||(PINC & (1 << PC3))) //wenn PB1 oder PC3 High ist... { PORTC |= (1 << PC1); //PC1 High } if (PINB & (1 << PB0)||(PINC & (1 << PC2))) //wenn PB0 oder PC2 High ist... { PORTC |= (1 << PC0); //PC1 High } if (!(PINB & (1 << PB0))||!(PINC & (1 << PC2))) //wenn PB0 Low ist... { PORTC &= ~(1 << PC0); //PC0 Low } if (!(PINB & (1 << PB1))||!(PINC & (1 << PC3))) //wenn PB1 Low ist... { PORTC &= ~(1 << PC1); //PC1 Low } } return 0; }
in „ATMEGA8 Ausgang mit Timer schalten“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test123.c
received_address; int main(void) { usart_init(); IO_init(); while(1) { a=100; if (channel[5] >= a) {PORTC |= (1<<PC5);} else {PORTC &= ~(1<<PC5);} while (!(UCSRA &(1<<RXC))) { } dmx_byte = UDR; if (UCSRA &(1<<DOR)) // DataOverRun? Fehler!! { UCSRA &= ~(1<<DOR); // DataOverRun-Flag wieder nullen dmx_status
in „DMX Empfang mit AVR“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test123.c
warten } if (UCSRA &(1<<FE)) // Nach Framing_error schauen könnte ja Anfang sein { received_address=0; PORTC |= (1<<PC3); UCSRA &= ~(1<<FE); // FramingError wieder nullen dmx_status=2; // 1 = eventuell eine Anfangskondition PORTC &= ~(1<<PC3); } else { if(dmx_status == 2) { received_address++; channel[received_address] = dmx_byte; PORTC |= (1<<PC4); if (channel[5] > 128) {PORTC |= (1<<PC5);} else {PORTC &= ~(1<<PC5);} PORTC &= ~(1<<PC4); } } } } /******************************************* USART-Programme *************************
in „DMX Empfang mit AVR“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
servo.bas
deklarieren Declare Sub On_int0 Declare Sub On_int1 'LCD Initialisieren Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , _ Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0 Config Lcd = 16 * 2 Cls Cursor Off 'PD2(Int0) und PD3(INT1) als Eingang , PD7 und PD7 als Servo und PB0 als Ausgang(
in „Bascom Unerklärlicher Fehler im Programm“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.c
void wait_ms(int x){ int i=0; for(i=0;i<x;i++){ _delay_ms(10); } } int main(void) { DDRC = 0xFF; PORTC = 0x00; DDRD = 0xFF; DDRB = 0xFF; // Strom fur LCD-Beleuchtung PORTB |= (1 << 0); PORTD &= ~(1 << 7); // Strom furs LCD-Display PORTB |= (1 << 7); PORTB &= ~(1 << 6); lcd_init(); /* lcd_data('T');
in „Atmega8, ADC und der GP2D12“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Neues_Textdokument.txt
//das ganze ist ein switch(umschalter), schaltet zwischen den case durch die variable i { case 0: PORTC=0xFF; i++; break; case 1: PORTC=0b1111110; i++; break; case 2: PORTC=0b1111100; i++; break; case 3: PORTC=0b1110100; i++; break; case 4: PORTC=0b1100100; i=0; break; } TCNT1=53816; //Timer/Counter1
in „AVR Programm, brauche Hilfe bei Kommentar bitte“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Neues_Textdokument.txt
//das ganze ist ein switch(umschalter), schaltet zwischen den case durch die variable i { case 0: PORTC=0xFF; i++; break; case 1: PORTC=0b1111110; i++; break; case 2: PORTC=0b1111100; i++; break; case 3: PORTC=0b1110100; i++; break; case 4: PORTC=0b1100100; i=0; break; } TCNT1=53816; //Timer/Counter1
in „AVR Programm, Kommentare bitte“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
poti.txt
mit 4.0 MHz #include <avr/delay.h> // definiert _delay_ms() DDRC = (1 << DDC0) | (1 << DDC1); // portc pin 0 und 1 als ausgang definieren (zu poti) PORTC= (1<<PC0) | (1<<PC1); // portc pin 0 und 1 auf 1 setzen (wegen poti) // portc pin 2 und 3 sind autom. auf eingang gesetzt if ( PORTC & (1<<PINC2)
in „digitales poti ansteuern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.c
+ 0 für Write Zugriff --> 0x50 PORTC |= 0xFC; if(retVal == 0x28 || retVal == 0x18) { PORTC &= ~(1<<7); //letzte LED einschalten } else if(retVal==0x30 || retVal==0x20) { PORTC &= ~(1<<6); //vorletzte LED einschalten } else if(retVal==0x38) { PORTC &= ~(1<<5); //letzte LED einschalten } else { PORTC &= ~(1<<4); //letzte LED einschalten } _delay_ms(100); i2c_stop(); _delay_ms(10); } return 0; }
in „RN-Control und MAX520 mit i2c bus - NACK nach Adress-Byte“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.c
= 0x8E; disp_init(); lcd_gotoxy(0,1); lcd_puts("Ready"); while(1) { if(CountVariable0 == 129) { //PORTC &= 0xFE; //LED Rt aus PORTC |= 0x01; //LED Rt an } if(CountVariable0 == 258) { PORTC &= 0xFE; //LED Rt aus CountVariable0 = 0; } if(CountVariable1 == 645) { PORTC &= 0xFD; //LED Gr an PORTC |= 0x02
in „ADC Conversion“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
main.c
TWIS_ReadNack (); #if DEBUG_ON uart_puts("i2c_read: ok\r\n"); #endif TWIS_Stop (); if (read_byte[0] == 1) {PORTC = PINC ^ (1<<O_CH_00);} if (read_byte[1] == 1) {PORTC = PINC ^ (1<<O_CH_01);} if (read_byte[2] == 1) {PORTC = PINC ^ (1<<O_CH_02);} if (read_byte[3] == 1) {PORTC = PINC ^ (1<<O_CH_03);} if (read_byte[4] == 1) {PORTC = PINC ^ (1<<O_CH_04);} if (read_byte[5] == 1) {PORTC = PINC ^ (1<<O_CH_05);} if (read_byte[6] == 1) {PORTB = PINB ^ (1<<O_CH_06);} if (read_byte[7] == 1) {PORTB = PINB ^ (1<<O_CH_07);} OCR1A = read_byte
in „Problem mit 2 ISR bei Mega16“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
m8a_Pin-Test2.c
PORTB, _BV(PB4) }, { (uint16_t)&DDRB, (uint16_t)&PORTB, _BV(PB5) }, { (uint16_t)&DDRC, (uint16_t)&PORTC, _BV(PC0) }, { (uint16_t)&DDRC, (uint16_t)&PORTC, _BV(PC1) }, { (uint16_t)&DDRC, (uint16_t)&PORTC, _BV(PC2) }, { (uint16_t)&DDRC, (uint16_t)&PORTC, _BV(PC3) }, { (uint16_t)&DDRC, (uint16_t)&PORTC, _BV(PC4) }, { (uint16_t)&DDRC, (uint16_t)&PORTC, _BV(PC5) }, { (uint16_t)&DDRD, (uint16_t)&PORTD, _BV(PD0) }, { (uint16_t)&DDRD, (uint16_t)&PORTD, _BV(PD1) }, { (uint16_t)&DDRD, (uint16_t)&PORTD, _BV(PD2) }, { (uint16_t)&DDRD, (uint16_t)&PORTD,
in „Atmega8A: loop über Ports/Pins funktioniert nicht“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
menue.c
in der Uhrzeit { PORTC=kette[i]; //Zeit anlegen sbi(PORTA,E); //Schreiben delay(); //Warten cbi(PORTA,E); //Disablen } } void init() { cbi(PORTA,RS); //Befehlsmodus setzen cbi(PORTA,RW); //Schreibmodus setzen cbi(PORTA,E); //Enable off PORTC=FUNCTIONSET; //Kommando sbi(PORTA,E); //Kommando übernehmen delay(); //Warten cbi(PORTA,E); //Enable off PORTC=DISPONNOCURSOR; sbi(PORTA,E); delay(); cbi(PORTA,E); PORTC=CLRDISPANF; sbi(PORTA,E); delay
in „Atmega161 für Menü auf LCD (Vorschläge?)“ · Projekte & Code ·
-
Datei
dzm.txt
As Long Config Timer1 = Timer , Prescale = 256 , Capture Edge = Rising Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , Rs = Portc.3 , E = Portc.1 Config Lcd = 16 * 2 On Ovf1 Ontvf1 On Icp1 Oncapture Enable Icp1 Enable Ovf1 Enable Interrupts Main: V = 0 W3 = 0 Impulse
in „Drehzahlmesser 4 mal 7-segment mit 90S2313“ · Projekte & Code ·
-
Datei
keys.c
spalte 1, zeile 2 = #4 if (temp & 8) // 4tes bit = 1te zeile reg |= 1; // spalte 1, zeile 1 = #1 PORTC |= (1 << MTX_Start); // pin wieder auf VCC ziehen PORTC &= ~(1 << (MTX_Start - 1)); // 2te spalte auf GND ziehen nop; nop; nop; nop; temp = PINC; temp >>= MTX_End; if (temp & 1) reg |= (1 << 10); if (temp & 2) reg |= (1 << 7); if (temp & 4) reg |= (1 << 4); if (temp & 8) reg |= (1 << 1); PORTC |= (1 << (MTX_Start - 1)); PORTC &= ~(1 << (MTX_Start - 2)); nop; nop; nop; nop; temp = PINC; temp >>= MTX_End; if (temp & 1) reg |= (1 << 11); if (temp & 2) reg |= (1 << 8); if (temp & 4) reg |= (
in „Matrix Tastatur mit int. Pullups“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Test.asm
PORTB , 0 sbi PORTB , 1 sbi PORTB , 2 sbi PORTB , 5 sbi PORTB , 6 sbi PORTB , 7 out DDRC , r17 sbi PORTC , 0 sbi PORTC , 1 sbi PORTC , 2 sbi PORTC , 5 sbi PORTC , 6 sbi PORTC , 7 out DDRE , r17 sbi PORTE , 0 sbi PORTE , 1 sbi PORTE , 2 sbi PORTE , 5 sbi PORTE , 6 sbi PORTE , 7 ;-----------------------
in „Es tut sich nichts“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
meag64_address.asm
_3 ;wenn nicht 3 dann weiter sbi PORTC, 2 ;wenn 3 dann relaise 3 Schalten rx_3: cpi mp, 0x34 ;mit 4 vergleiche brne rx_4 ;wenn nicht 4 dann weiter sbi PORTC, 3 ;wenn 4 dann relaise 4 Schalten rx_4: cpi mp, 0x35 ;mit 5 vergleiche brne rx_e ;wenn nicht 5 dann weiter sbi PORTC, 4 ;wenn 5 dann relaise 5 Schalten rx_e: cpi mp, 0x65 ;mit e vergleiche brne rx_end ;wenn nicht e dann ende ldi mp, 0x00 ;wenn e dann alle relaise ausschalten out PORTC, mp rx_end: pop mp ;mp Lesen
in „mega64 UART“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
USART1.c
LED_Display.h" #include "Unterprogramme.h" int Texteingabe = 0, Uhrzeitanzeige = 0; void UART1() { PORTC |= (1<<PC5); _delay_ms(500); PORTC &=~ (1<<PC5); _delay_ms(500); PORTC |= (1<<PC5); _delay_ms(500); PORTC &=~ (1<<PC5); if (UCSRA & (1<<RXC))//Wenn was empfangen wird dann: { PORTC |= (1<<PC5); _delay_ms(500); PORTC &=~ (1<<PC5); if (UDR == 240) //Startbyte für Textanzeige { Text = 1; Farbeinstellung = 1; Uhrzeit1 = 0; } else if (UDR == 241) { Farbeinstellung = 1; Uhrzeit1 = 1; Text = 0; } if (Farbeinstellung
in „Controller kann Funktionen in anderen Files manchmal nicht aufrufen“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
_erstflug_Airwolf_dezember.bas
Config Portb.2 = Output Config Portb.3 = Output Config Portb.4 = Output Config Portb.5 = Output Config Portc.3 = Output Config Portc.4 = Output Config Portc.5 = Output Config Pind.1 = Input 'Anschluss am RC Empfänger Config Portd.2 = Output 'Servoausgang Masch1 Alias Portb.2 Masch2 Alias Portb.3 Blitzu Alias Portb.5 Blitzo Alias Portb.4 Heck Alias Portc.3 Gruen Alias Portc.4 Rot Alias Portc.5 Rot = 1 Gruen = 1 Dim Beacon As Byte ' Blitzlicht High periodendauer Dim Beaconp As Byte ' Blitzlicht Pausendauer Dim Rckanal As Word ' Wert von Pulsein Beacon
in „Probleme Bascom Servo Steuerung / Kanalauswertung“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
ATA_Floppy_mit_ATmega.txt
read DDRB=0b11; PORTB=PORTB | 0b11; //Da beide Signale invertiert, müssen sie per default an sein PORTC=PORTC | (0b11<<5); //Chip select ist ebenfalls invertiert TWCR=0b100 | (1<<6); //TWI Enable TWBR=72; //100kHz bei CPU @ 16MHz TWAR=20; //Slave adress: 20 DDRD=0; //Lo-Byte Datenleitung DDRA=0; //High-Byte Datenleitung PORTD=255; PORTA=255; PORTC=PORTC | (1<<7); //Reset abschalten => Laufwerke hochfahren PORTC= (PORTC & clr_bit) | stat_command; //Alternate status register anwählen while(1){ PORTB=PORTB & ~0b10; //read __asm volatile("NOP");
in „ATA Floppy mit ATmega1284P ansteuern“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
lcd_zaehler.asm
RS zu setzen mov temp2, temp1 swap temp1 andi temp1, 0b00001111 out PORTC, temp1 rcall lcd_enable andi temp2, 0b00001111 out PORTC, temp2 rcall lcd_enable rcall delay50us ret ;erzeugt den Enable-Puls lcd_enable: sbi PORTC, 5 ;Enable high nop ;3 Taktzyklen warten nop nop
in „26 bit umwandlung in ASCII“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
lcd.txt
unsigned int i; PORTD.6=0; //Kommandoübergabe RS PORTD.7=1; //Bei fallender Flanke werden Daten am PortC ausgegeben PORTC=comdaten; //Übergabe der Daten an PORTC for (i=0;i<=5;i++); //Entprellen PORTD.7=0; //bei fallender Flanke wird Kommando ausgeführt for (i=0;i<=500;i++); //Entprellen } void asc_out
in „Ausgabe 3-stelliger Zahlen auf Display“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
lcd2.txt
unsigned int i; PORTD.6=0; //Kommandoübergabe RS PORTD.7=1; //Bei fallender Flanke werden Daten am PortC ausgegeben PORTC=comdaten; //Übergabe der Daten an PORTC for (i=0;i<=5;i++); //Entprellen PORTD.7=0; //bei fallender Flanke wird Kommando ausgeführt for (i=0;i<=500;i++); //Entprellen } void asc_out
in „If Bedingung ohne Funktion“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test.asm
0b11111110 out portc, r16 rjmp Timer2W Timer3A: in r16, pinc push r16 ldi r16, 0b00000001 out portb, r16 ;::::::::::Zeitschleife hier einfügen:::::::: nop ;:::::::::::::::::::::::::::::::::::::::::::: pop r16 andi r16,
in „Operand 2 Out Of Range“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
Yumurta.c
break; case 8: PORTD=0b00000000; break; case 9: PORTD=0b00010000; break; } } void ausgabe (void) { PORTC=0b00000110; led (min); _delay_ms(1); PORTC=0b00000101; led (dez); _delay_ms(1); PORTC=0b00000011; //LOW ist"on"! led (sek); _delay_ms(1); } main() { DDRD=0xFF; DDRC=0b11010111; TCCR1B=(1<<CS12); TIMSK
in „Programme haben plötzlich bugs. AVR Studio 4 und STK500“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
belichter.c
safestart > 2) { safestart = 0; } if(timeisrun) { startcounter --; if(startcounter == 0) { int temp = PORTC & 0b111000; PORTC= temp & 0b000111; anzeige_7seg_zahl(startcounter); _delay_ms(1000); startcounter = eeprom_read_word(&counter_eeprom); timeisrun = 0; } } } int main( void ) { wdt_enable(7); initports
in „delay.h defekt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
belichter.c
) { safestart = 0; } if(timeisrun) { startcounter --; if(startcounter == 0) { int volatile temp = PORTC & 0b111000; PORTC= temp & 0b000111; timeisrun = 0; } } } int main( void ) { //wdt_enable(7); initports(); init_timer(); init_taster(); init_7seg(); startcounter = eeprom_read_word(&counter_eeprom);
in „delay.h defekt“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
pwm.bas
Config Portb.1 = Output Config Portb.2 = Output Config Portb.3 = Output Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0 Config Lcd = 16 * 2 Config Rc5 = Pinb.0 Config Timer1 = Pwm , Pwm = 8 , Compare A Pwm = Clear Up , Compare B Pwm = Clear
in „Algorithmus zum Farbwechsel bei RGB Led“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
roboter_1.c
define F_CPU 16000000UL #include <avr/io.h> #include <util/delay.h> int vorwaerts_start_langsam() { PORTC |= (1<<PC0)|(1<<PC2); OCR1AH = 0x80;//Setze auf 32768 OCR1AL = 0x00; OCR1BH = 0x80; OCR1BL = 0x00; return 1; }//vw_start int vorwaerts_start_schnell() { PORTC |= (1<<PC0)|(1<<PC2); OCR1AH = 0xff;//
in „Probleme mit PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
roboter_v_0.1.c
define F_CPU 16000000UL #include <avr/io.h> #include <util/delay.h> int vorwaerts_start_langsam() { PORTC |= (1<<PC0)|(1<<PC2); OCR1AH = 0x80;//Setze auf 32768 OCR1AL = 0x00; OCR1BH = 0x80; OCR1BL = 0x00; return 1; }//vw_start int vorwaerts_start_schnell() { PORTC |= (1<<PC0)|(1<<PC2); OCR1AH = 0xff;//
in „Probleme mit PWM“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
test.txt
unsigned int i; PORTD.6=0; //Kommandoübergabe RS PORTD.7=1; //Bei fallender Flanke werden Daten am PortC ausgegeben PORTC=comdaten; //Übergabe der Daten an PORTC for (i=0;i<=5;i++); //Entprellen PORTD.7=0; //bei fallender Flanke wird Kommando ausgeführt for (i=0;i<=500;i++); //Entprellen } void asc_out
in „Ausgabe 3-stelliger Zahlen auf Display“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
lcd.c
// Bits zur Ansteuerung der 1x8 Zeichen-LCD im 4-Bit Modus // des olimex AVR-PX128A1 #define RS1 PORTC.OUT |= (1<<PIN1) // PC1=1 #define RS0 PORTC.OUT &= ~(1 << PIN1) // PC1=0 #define RW1 PORTC.OUT |= (1<<PIN2) // PC2=1 #define RW0 PORTC.OUT &= ~(1 << PIN2) // PC2=0 #define E1 {PORTC.OUT |= (1<<PIN3) ; _delay_us(1);} // PC3=1 #define E0 {PORTC.OUT &= ~(1 << PIN3);_delay_us(1);} // PC3=0 // die 4 Datenbit im 4-Bit-Modus! zum LCD sind // PE7 PE6 PE5 PE4 // an LCD D7 D6 D5 D4 /*---------------------------------------------------------------
in „xmega olimex avr-px128a1 lcd-Ansteuerung“ · Projekte & Code ·
-
Datei
lcd.asm
STATUS, RP0 ; Bank 1 movlw Ini_opt ; pull-up on movwf OPTION_REG movlw B'00000000' ; PortC make all outputs movwf TRISC movwf TRISB bcf STATUS, RP0 ; Bank 0 clrf PORTB clrf PORTC movlw Ini_con ; Interupt disable movwf INTCON call InitLcd ;display init Main ;display hello on lcd movlw 'H'
in „PIC16F690 init vom LCD funzt nich“ · Mikrocontroller und Digitale Elektronik ·
-
Datei
tasks.c
display_cnt = globale Variable (für Display 1-6)*/ switch(display_cnt){ case '1': PORTA=tor_heim; PORTC=0xfe; display_cnt++; break; case '2': PORTA=(minute-(minute%10))/10; PORTC=0xfd; display_cnt++; break; case '3': PORTA=minute%10; PORTC=0xfb; display_cnt++; break; case '4': PORTA=(sekunde-(sekunde%10))/10; PORTC=0xf7; display_cnt++; break; case '5': PORTA=(sekunde%10); PORTC=0xef; display_cnt++; break; case '6': PORTA=tor_gast; PORTC=0xdf; display_cnt=1; break; } } void close_display_task(void){ PORTC=0xff
in „mehrere source files“ · Mikrocontroller und Digitale Elektronik ·