Hallo. Ich möchte einen SiLabs C8051F300 in C programmieren. Ich hab den WDT deaktiviert, alle Pins initialisiert und den internen Oszillator eingestellt. Ich möchte zuerst mal nur einen Ausgang aus bzw einschalten, bisher leider ohne Erfolg. hat jemand eine Idee woran es leigen könnte. *** #include <c8051f300.h> sbit Taster = P0^5; sbit LED1 = P0^0; sbit LED2 = P0^3; void OSCILLATOR_Init(void); void PORT_Init(void); void main(void) { OSCILLATOR_Init(); PORT_Init(); LED1 = 1; LED2 = 0; P0 = 0x41; } void OSCILLATOR_Init(void) { OSCICN = 0x04; //internal Oscillator, lowest frequency } void PORT_Init (void) { P0MDIN = 0xEF; // Select P0.4 as analog input P0MDOUT = 0x45; // Select p0.6, P0.0 und 0.3 as push-pull output XBR0 = 0x10; // P0.4(ADC) is skipped by the crossbar XBR1 = 0x00; // keine special Functions on Pin available XBR2 = 0x40; // enable crossbar and weak pull-ups PCA0MD = 0x00; // Watchdog Timer deaktivieren }
Vielleicht sollte es 0x49 anstatt 0x45 heissen:
1 | P0MDOUT = (1<<0)|(1<<3)|(1<<6); // (== 0x49) |
moin moin, sind die InitWerte vom ConfigTool? Wenn nicht... Configuration Wizard 2 Release 2.40 Release Notes Copyright (C) 2009 Silicon Laboratories, Inc. ...holen. mfg Pieter
Nimm doch einfach das gute alte Blinky Beispiel. Beim Initialisieren darauf achten dass die Crossbar richtig initialisiert wird. Ansonsten kannst Du einzelne Ports auch skippen.
Versuch mal den Watchdog timer gleich als aller erstes zu deaktivieren!
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.