8051 c programming, interrupt progblem -


I am programming an Intel 8051 (C8051F312) microcontroller. I just want to make a blinking lead program using interrupts, it's compiled, but there is no leadership swift. Any thoughts I appreciate thank you!

My code is:

  #include & lt; C8051F310.H> # Include & lt; Stdio.h & gt; Sbit Leadership = P2 ^ 7; // DTI port 2 is connected to zero timer (zero) 1 / center no difference for timer 1 0 led = lead; // interrupt TH0 = 0xFC on toggle LED; // The initial value is loaded on the timer TL0 = 0x66; } Zero main (zero) {tmod = 0x01; // mode 1 timer 0 TH0 = 0xFC; // The initial value is loaded on the timer TL0 = 0x66; EA = 1; // Enable global interrupt ET 0 = 1; // Enable Timer 0 TR0 = 1 inhibited; // Start timer while (1); // nothing)  

As told above, knock down your interrupt rate have to give . Your original code is interfering at 3.0625 MHz / 12/9 22 ~ 277 Hz. Additional part of your CKCON disables scaling on timer (by setting Tm), so now you are interfering at ~ 3.3 kHz. You will not be able to see it.

Seeing anything, you have a functional circuit that you are not configuring your output pin. You have said that your LED is on "now", but it is not expected that it was not before This will not make any sense because you can not change anything about the pin.

  1. Line / 12 scaling to get rid of your CKCON , and TH0 and TL0 Interrupt with 0x00 . This will interfere slightly less than 4 Hz, and be more visible.

  2. Push-pull that pin:

      P2MDOUT = 0x80; XBR1 = 0x40;  
  3. Start reading your microphone


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -