Friday, May 20, 2011
Simple Test Running LED
step 1). make Scheme on your project like the picture
setp 2). copy paste code listing program in BascomAVR
'// Simple Running LED
'// Using PortC as output
$regfile = "m8535.dat"
$crystal = 1000000
Config Portc = Output
Main:
Do
Portc = 00000001
Waitms 100
Portc = 00000011
Waitms 100
Portc = 00000111
Waitms 100
Portc = 00001111
Waitms 100
Portc = 00011111
Waitms 100
Portc = 00111111
Waitms 100
Portc = 01111111
Waitms 100
Portc = 11111111
Waitms 100
Portc = 00000000
Waitms 100
Loop
step 3). Compile Program ( click Program > Compile (F7) on BascomAVR )
step 4). Download to Your Microcontroller with ISP Programmer
High Voltage Pulse Generator Electronic Circuit
This circuit generates high voltage pulses from 230vac line voltage. The drive end's swing comparator circuit is invented by the creator of this page. The work end is derived from stroboscope trig supply circuit. All line voltage using circuits are inherently dangerous, and this is particulary so. Do not build it.
Specifications and schematic
Input voltage 230vac 50/60Hz
Output voltage -25kV pulse (T=200uS)
Output peak current -0,4A
Output pulse energy 0,3J
Average output power 15W
Trig event control at 180...270 deg.of phase
Operation
When powered up, the circuit generated fierce arc of 25mm length, between the coil secondary. The waveforms depicted in the schematic were observed. The output current was measured by letting the sparks ground via a 10ohm resistor, and measuring the voltage over the resistor with an oscilloscope. The trig event control was observed between ca.180...270 degrees of phase angle, by turning the 470K potentiometer. The sheet of paper placed between arc bursted immediately in flames.
Light Dark Sensor With Relay Circuit Using LM741
Above is a schematic diagram of an LM741 light/dark sensor circuit (from the excellent 741 Op-Amp Tutorial by Tony van Roon).The ECG128/NTE128 transistor stipulated can be substituted with any NPN transistor rated at sufficient gain and current for the chosen relay coil.
We have modified the schematic diagram above with the addition of a 220uF smoothing capacitor between the base of transistor Q1 and ground. Without this capacitor, the relay chatter (relay switching on and off many times per second) was terrible around the switch on/off light level. By adding the capacitor, relay chatter was completely eliminated.
According to the designer of this circuit, the relay will be closed only when "NO light falls on LDR1", however, in testing this circuit proved to work very well with the user able to adjust the potentiometer (P1) to automatically close the relay at whatever light level they chose. By swapping the postitions of the 10K resistor (R1) and the LDR (LDR1), the relay will be closed when the LDR is under light rather than under darkness. Therefore a device can automatically be switched off at nighttime.
Since this circuit still contains a relay we need to make some changes* to reduce the amount of power to make it more suitable for renewable energy powered low-current applications.
MOSFET BUZ902DP 400Watt Audio Power Amplifier
400Watt Audio Power Amplifier circuit with MOSFET BUZ902DP
If you like in the sound system or sound this circuit will should like you , This amplifier has two completely separate mono amplifiers with each channel has its own power supply to the order of zero channel crosstalk, a common phenomenon in amplifiers have the same food.
To view the full performance of each supply transformer should be evaluated at 40VAC – 0 – 40VAC at 640VA.
Unlike many models of capacitors is a reservoir to supply the peak currents, I prefer the power transformer in a much faster transient. BUZ902DP Although the specifications are rather modest,
if they can hear you now to experience a large reserve of power available and never any reason to worry that something to do than drive a large number of amplifiers aloud. You do not hear nothing but the truth without distortion at all levels, and I can assure you that this amplifier is required to provide the best features coupled.
SIMPLE POWER SUPPLY
Series of pictures above you can make application for the adapter or power suplly with the output voltage (V DC 12V output). Power supply on the only protected by capasitor as if the power supply is connected in series with the load. Therefore I suggest using the minimal specification capasitor with 35V. To power the power supply the more we can menggunakkan transistor TIP. To bridge dioda you can stack 4 of dioda then you become one solder bridge rectifier, or you can buy a bridge rectifier so that comb-shaped (sideways) or the box. Most dioda bridge I do not recommend using the 1 Ampere, in a series of adapter, the greater ampere dioda the better way in the current series. Dioda a toll road, and as the flow through the car. The large and wide toll road that is, the more rapid flow and run through a series of.
For the series of 5 V power supply, you can change the volt regulator on the type 7805 and 7905. This application applies the same in this series. For the series of variations such as the fuse or switch on / off you can try yourself. + 18 V transformer - at least 1 A CT
Capasitor at least 35 + V
Wednesday, May 18, 2011
ADC TEST
Here simple Bascom AVR code to use internal ADC in AVR ATMEGA8535 using Basic Compiller AVR
In this project use PORTA.0 as ADC(0) with display LCD 16x2.
Copy paste this code in BASCOM AVR
$regfile = "m8535.dat"
$crystal = 12000000
'$sim
Dim Volt As Long
Config Adc = Single , Prescaler = Auto , Reference = Internal
Cursor Off
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db7 = Portb.7 , Db6 = Portb.6 , Db5 = Portb.5 , Db4 = Portb.4 , E = Portb.3 , Rs = Portb.2
Do
Start Adc
Volt = Getadc(0)
Waitus 200
Stop Adc
Cls
Locate 1 , 1
Lcd " TEST ADC"
Lowerline 'Lowerline LCD
Lcd Volt
Waitms 100
Loop
In this project use PORTA.0 as ADC(0) with display LCD 16x2.
Copy paste this code in BASCOM AVR
$regfile = "m8535.dat"
$crystal = 12000000
'$sim
Dim Volt As Long
Config Adc = Single , Prescaler = Auto , Reference = Internal
Cursor Off
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db7 = Portb.7 , Db6 = Portb.6 , Db5 = Portb.5 , Db4 = Portb.4 , E = Portb.3 , Rs = Portb.2
Do
Start Adc
Volt = Getadc(0)
Waitus 200
Stop Adc
Cls
Locate 1 , 1
Lcd " TEST ADC"
Lowerline 'Lowerline LCD
Lcd Volt
Waitms 100
Loop
Tuesday, May 17, 2011
PING Parallax with LCD Display
Step to make project :
- Open CodeVisionAVR C Compiler
- Click File -> New
- Chose project OK
- Click Yes
Example : Ping.c (for file source
Ping.prj (for file project)
Ping.cwp (for file Code Wizard Project)
#include <mega8535.h>
#include delay.h>
#include <stdio.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x1B ;PORTA
#endasm
#include <lcd.h>
// Declare your global variables here
#define SigOut PORTB.0
#define SigIn PINB.0
#define DirSig DDRB.0
unsigned int counter;
float distance;
unsigned char Row1[16];
unsigned char Row2[16];
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// LCD module initialization
lcd_init(16);
While (1) {
// Place your code here
counter=0; //Initial value
DirSig=1; //Set as output
SigOut=1;
delay_us(5);
SigOut=0;
DirSig=0; //Set as input
SigOut=1; //Pullup activated
while (SigIn==0)
{}
while (SigIn==1)
{counter++;}
// V=344.424m/s
distance=(counter*0.034442); //clock 4,0000 Mhz
//distance=(counter*0.034442)/2; //clock 11,0592 Mhz
sprintf(Row1,"Counter=%5d uS",counter);
sprintf(Row2,"Distance: %3.2f cm",distance);
lcd_gotoxy(0,0);lcd_puts(Row1);
lcd_gotoxy(0,1);lcd_puts(Row2);
delay_ms(200);
lcd_clear();
};
}
#include <mega8535.h>
#include delay.h>
#include <stdio.h>
// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x1B ;PORTA
#endasm
#include <lcd.h>
// Declare your global variables here
#define SigOut PORTB.0
#define SigIn PINB.0
#define DirSig DDRB.0
unsigned int counter;
float distance;
unsigned char Row1[16];
unsigned char Row2[16];
void main(void)
{
// Declare your local variables here
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;
// Port B initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTB=0x00;
DDRB=0x00;
// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTC=0x00;
DDRC=0x00;
// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;
// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;
// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;
// Timer/Counter 2 initialization
// Clock source: System Clock
// Clock value: Timer 2 Stopped
// Mode: Normal top=FFh
// OC2 output: Disconnected
ASSR=0x00;
TCCR2=0x00;
TCNT2=0x00;
OCR2=0x00;
// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
MCUCSR=0x00;
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;
// LCD module initialization
lcd_init(16);
While (1) {
// Place your code here
counter=0; //Initial value
DirSig=1; //Set as output
SigOut=1;
delay_us(5);
SigOut=0;
DirSig=0; //Set as input
SigOut=1; //Pullup activated
while (SigIn==0)
{}
while (SigIn==1)
{counter++;}
// V=344.424m/s
distance=(counter*0.034442); //clock 4,0000 Mhz
//distance=(counter*0.034442)/2; //clock 11,0592 Mhz
sprintf(Row1,"Counter=%5d uS",counter);
sprintf(Row2,"Distance: %3.2f cm",distance);
lcd_gotoxy(0,0);lcd_puts(Row1);
lcd_gotoxy(0,1);lcd_puts(Row2);
delay_ms(200);
lcd_clear();
};
}
Monday, May 16, 2011
Microcontroller ATMega8535
Microcontroller ATMega8535
Features
• High-performance, Low-power AVR® 8-bit Microcontroller
• Advanced RISC Architecture
– 130 Powerful Instructions – Most Single Clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• Nonvolatile Program and Data Memories
– 8K Bytes of In-System Self-Programmable Flash
Endurance: 10,000 Write/Erase Cycles
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– 512 Bytes EEPROM
Endurance: 100,000 Write/Erase Cycles
– 512 Bytes Internal SRAM
– Programming Lock for Software Security
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Four PWM Channels
– 8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels for TQFP Package Only
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x for TQFP
Package Only
– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby
• I/O and Packages
– 32 Programmable I/O Lines
– 40-pin PDIP, 44-lead TQFP, 44-lead PLCC, and 44-pad QFN/MLF
• Operating Voltages
– 2.7 - 5.5V for ATmega8535L
– 4.5 - 5.5V for ATmega8535
• Speed Grades
– 0 - 8 MHz for ATmega8535L
– 0 - 16 MHz for ATmega8535
Microcontroller ATMega16
Features
• High-performance, Low-power Atmel® AVR® 8-bit Microcontroller
• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• High Endurance Non-volatile Memory segments
– 16 Kbytes of In-System Self-programmable Flash program memory
– 512 Bytes EEPROM
– 1 Kbyte Internal SRAM
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
– Data retention: 20 years at 85°C/100 years at 25°C(1)
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– Programming Lock for Software Security
• JTAG (IEEE std. 1149.1 Compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Four PWM Channels
– 8-channel, 10-bit ADC
8 Single-ended Channels
7 Differential Channels in TQFP Package Only
2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
– Byte-oriented Two-wire Serial Interface
Microcontroller ATMega8
ATMega8 - 8 bit AVR Microcontroller with 8k Bytes In-System Programmable Flash
Advanced RISC Architecture
- 130 Powerful Instructions - Most Single Clock Cycle Execution
- 32 x 8 General Purpose Working Registers
- Up to 6 MIPS Throughput at 16MHz
- Fully Static Operation
- On-chip 2-cycle Multiplier
Nonvolatile Program and Data Memories
- 8k Bytes of In-System Self-Programmable Flash
- Optional Boot Code Section with Independent Lock Bits
- 512K Bytes EEPROM
- Programming Lock for Software Security
- 1K Byte Internal SRAM
Peripheral Features
- On-chip Analog Comparator
- Programmable Watchdog Timer with Seperate On-chip Oscillator
- Master/Slave SPI Serial Interface
- Two 8-bit Timer/Counters with Separate Prescalar, Compare
- One 16-bit TImer/Counter with Seperate Prescaler, Compare and Capture mode
- Real TIme Counter with Seperate Oscillator
- Three PWM Channels
- 8-channel ADC in TQFP and MLF package
- 6-channel ADC in PDIP package
- Byte-oriented Two-wire Serial Interface
- Programmable Serial USART
Special Mircocontroller Features
- Power-on Reset and Programmable Brown-out Detection
- Internal Calibrated RC Oscillator
- External and Internal Interrupt Sources
- Five Sleep Modes: Idle, ADCNoise Reduction, Power-save, Power-down and Standby
I/O and Packages
- 23 Programmable I/O Lines
- 28-lead PDIP, 32-lead TQFP, 32-pad MLF
Operating Voltages
- 4.5-5.5V for ATmega8
Speed Grades
- 0-16 MHz for ATmega8
Power Consumption at 4 Mhz, 3V, 35 °C
- Active: 3.6mA
- Idle Mode: 10mA
- Power-down Mode: 0.5 µA
ATMega8 Features
Advanced RISC Architecture
- 130 Powerful Instructions - Most Single Clock Cycle Execution
- 32 x 8 General Purpose Working Registers
- Up to 6 MIPS Throughput at 16MHz
- Fully Static Operation
- On-chip 2-cycle Multiplier
Nonvolatile Program and Data Memories
- 8k Bytes of In-System Self-Programmable Flash
- Optional Boot Code Section with Independent Lock Bits
- 512K Bytes EEPROM
- Programming Lock for Software Security
- 1K Byte Internal SRAM
Peripheral Features
- On-chip Analog Comparator
- Programmable Watchdog Timer with Seperate On-chip Oscillator
- Master/Slave SPI Serial Interface
- Two 8-bit Timer/Counters with Separate Prescalar, Compare
- One 16-bit TImer/Counter with Seperate Prescaler, Compare and Capture mode
- Real TIme Counter with Seperate Oscillator
- Three PWM Channels
- 8-channel ADC in TQFP and MLF package
- 6-channel ADC in PDIP package
- Byte-oriented Two-wire Serial Interface
- Programmable Serial USART
Special Mircocontroller Features
- Power-on Reset and Programmable Brown-out Detection
- Internal Calibrated RC Oscillator
- External and Internal Interrupt Sources
- Five Sleep Modes: Idle, ADCNoise Reduction, Power-save, Power-down and Standby
I/O and Packages
- 23 Programmable I/O Lines
- 28-lead PDIP, 32-lead TQFP, 32-pad MLF
Operating Voltages
- 4.5-5.5V for ATmega8
Speed Grades
- 0-16 MHz for ATmega8
Power Consumption at 4 Mhz, 3V, 35 °C
- Active: 3.6mA
- Idle Mode: 10mA
- Power-down Mode: 0.5 µA
Microcontroller AT89S51/52
Use AT 89S51 IC has several benefits and advantages, including high-level constraints, external components hardwere less, ease of programming. And cost-efficient. AT 89S51 IC has an internal program that is easy to remove and re-programmed over and over - again. In this plane AT 89S51 IC serves as the central control of all aircraft activity. Starting from the timer to control the length of the electrode work. In this plane AT 89S51 IC is also used as modifiers for the thermal sensor temperature is converted in units of mineral content that is displayed in the form of seven segment displays.
Some functions of the pins on the IC legs AT89S51 microcontroller which is:
Port 0
Port 0 is the 8-bit open drain bi-directional port I / O. at the time as an output port, each pin can be passed to the input TTL-8. When the logic one is written to port 0, then these pins can be used as input high berimpendansi. Port 0 can be confirmed to demultiplex the data path / addres bus for reading the external program and data memory. In this mode P0 has internal Pullup. Port 0 also enerima code for programming Flash bytre. And issued a code of byte during program verification
Port 1
Port 1 is an 8 bit bi-directional port I / O with internal Pullup. 1 has the output port that can be connected with 4 TTL inputs. When logic '1 'is written to port 1, pin it on the pull Hight using internal pullup, and can be used as input. Port 1 also receives the addres dab Flash programming for verification.
Port 2
Port 2 is 8-bit bi directional port I / O with Pullup. Port 2 output buffers can spend four TTL inputs. When the logic one is written to port 2, then they dipull Hight with internal Pullup and can be used as input.
Port 3
Port 2 is 8-bit bi directional port I / O with Pullup. The output buffer of port 3 can be skipped four TTL inputs. When the logic one is written keport 3, then they will dipull Hight with internal pullup, and can be used as input. Port 3 also has a variety of functions / facilities. Port 3 also receives some control signals for Flash programming dab verification.
RST
Reset input. Hight logic on this pin will reset the machine cycle (IC).
ALE / Prog.
Addres output pulse is used to latch Enable lantching byte addres lower than during access to external memory. This pin is also the program pulse input during Flash programming. If desired, ALE operation can be disabled by setting bits to 0 of SFR at location 8EH. With Bit Set, ALE disabling, will not affect if the microcontroller in the external execution mode.
PSEN
Program Store Enable is the signal used to read external program memory. When the 8951 executes code from external program memory, PSEN is activated twice each machine cycle.
EA / VPP
External Access Enable, EZ must be positioned to GND to enable the device to feed the code of the program memory locations starting at 0000H up to FFFFh. EA should be positioned to VCC for internal program execution. This pin also receives 12-volt programming voltage (Vpp) during Flash programming.
XTAL1
Input for inverting oscillator amplifier and input to inte rnal clock to pengoperaian circuit.
XTAL2
Output from the inverting oscillator amplifier.
IC image AT89S51
Some functions of the pins on the IC legs AT89S51 microcontroller which is:
Port 0
Port 0 is the 8-bit open drain bi-directional port I / O. at the time as an output port, each pin can be passed to the input TTL-8. When the logic one is written to port 0, then these pins can be used as input high berimpendansi. Port 0 can be confirmed to demultiplex the data path / addres bus for reading the external program and data memory. In this mode P0 has internal Pullup. Port 0 also enerima code for programming Flash bytre. And issued a code of byte during program verification
Port 1
Port 1 is an 8 bit bi-directional port I / O with internal Pullup. 1 has the output port that can be connected with 4 TTL inputs. When logic '1 'is written to port 1, pin it on the pull Hight using internal pullup, and can be used as input. Port 1 also receives the addres dab Flash programming for verification.
Port 2
Port 2 is 8-bit bi directional port I / O with Pullup. Port 2 output buffers can spend four TTL inputs. When the logic one is written to port 2, then they dipull Hight with internal Pullup and can be used as input.
Port 3
Port 2 is 8-bit bi directional port I / O with Pullup. The output buffer of port 3 can be skipped four TTL inputs. When the logic one is written keport 3, then they will dipull Hight with internal pullup, and can be used as input. Port 3 also has a variety of functions / facilities. Port 3 also receives some control signals for Flash programming dab verification.
RST
Reset input. Hight logic on this pin will reset the machine cycle (IC).
ALE / Prog.
Addres output pulse is used to latch Enable lantching byte addres lower than during access to external memory. This pin is also the program pulse input during Flash programming. If desired, ALE operation can be disabled by setting bits to 0 of SFR at location 8EH. With Bit Set, ALE disabling, will not affect if the microcontroller in the external execution mode.
PSEN
Program Store Enable is the signal used to read external program memory. When the 8951 executes code from external program memory, PSEN is activated twice each machine cycle.
EA / VPP
External Access Enable, EZ must be positioned to GND to enable the device to feed the code of the program memory locations starting at 0000H up to FFFFh. EA should be positioned to VCC for internal program execution. This pin also receives 12-volt programming voltage (Vpp) during Flash programming.
XTAL1
Input for inverting oscillator amplifier and input to inte rnal clock to pengoperaian circuit.
XTAL2
Output from the inverting oscillator amplifier.
About Microcontroller
A microcontroller (sometimes abbreviated µC, uC or MCU) is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessorsused in personal computers or other general purpose applications.
Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, and toys. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems.
Some microcontrollers may use Four-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (milliwatts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just nanowatts, making many of them well suited for long lasting battery applications. Other microcontrollers may serve performance-critical roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption
Embedded design
A microcontroller can be considered a self-contained system with a processor, memory and peripherals and can be used as an embedded system.[1] The majority of microcontrollers in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for computer systems. These are called embedded systems. While some embedded systems are very sophisticated, many have minimal requirements for memory and program length, with no operating system, and low software complexity. Typical input and output devices include switches, relays, solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer, and may lack human interaction devices of any kind.
Interrupts
Microcontrollers must provide real time (predictable, though not necessarily fast) response to events in the embedded system they are controlling. When certain events occur, an interruptsystem can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR, or "interrupt handler"). The ISR will perform any processing required based on the source of the interrupt before returning to the original instruction sequence. Possible interrupt sources are device dependent, and often include events such as an internal timer overflow, completing an analog to digital conversion, a logic level change on an input such as from a button being pressed, and data received on a communication link. Where power consumption is important as in battery operated devices, interrupts may also wake a microcontroller from a low power sleep state where the processor is halted until required to do something by a peripheral event.
Programs
Microcontroller programs must fit in the available on-chip program memory, since it would be costly to provide a system with external, expandable, memory. Compilers and assemblers are used to convert high-level language and assembler language codes into a compact machine code for storage in the microcontroller's memory. Depending on the device, the program memory may be permanent, read-only memory that can only be programmed at the factory, or program memory may be field-alterable flash or erasable read-only memory.
Other microcontroller features
Microcontrollers usually contain from several to dozens of general purpose input/output pins (GPIO). GPIO pins are software configurable to either an input or an output state. When GPIO pins are configured to an input state, they are often used to read sensors or external signals. Configured to the output state, GPIO pins can drive external devices such as LEDs or motors.
Many embedded systems need to read sensors that produce analog signals. This is the purpose of the analog-to-digital converter (ADC). Since processors are built to interpret and process digital data, i.e. 1s and 0s, they are not able to do anything with the analog signals that may be sent to it by a device. So the analog to digital converter is used to convert the incoming data into a form that the processor can recognize. A less common feature on some microcontrollers is a digital-to-analog converter (DAC) that allows the processor to output analog signals or voltage levels.
In addition to the converters, many embedded microprocessors include a variety of timers as well. One of the most common types of timers is the Programmable Interval Timer (PIT). A PIT may either count down from some value to zero, or up to the capacity of the count register, overflowing to zero. Once it reaches zero, it sends an interrupt to the processor indicating that it has finished counting. This is useful for devices such as thermostats, which periodically test the temperature around them to see if they need to turn the air conditioner on, the heater on, etc.
Time Processing Unit (TPU) is a sophisticated timer. In addition to counting down, the TPU can detect input events, generate output events, and perform other useful operations.
A dedicated Pulse Width Modulation (PWM) block makes it possible for the CPU to control power converters, resistive loads, motors, etc., without using lots of CPU resources in tight timer loops.
Universal Asynchronous Receiver/Transmitter (UART) block makes it possible to receive and transmit data over a serial line with very little load on the CPU. Dedicated on-chip hardware also often includes capabilities to communicate with other devices (chips) in digital formats such as I2C and Serial Peripheral Interface (SPI).
Higher integration
In contrast to general-purpose CPUs, micro-controllers may not implement an external address or data bus as they integrate RAM and non-volatile memory on the same chip as the CPU. Using fewer pins, the chip can be placed in a much smaller, cheaper package.
Integrating the memory and other peripherals on a single chip and testing them as a unit increases the cost of that chip, but often results in decreased net cost of the embedded system as a whole. Even if the cost of a CPU that has integrated peripherals is slightly more than the cost of a CPU and external peripherals, having fewer chips typically allows a smaller and cheaper circuit board, and reduces the labor required to assemble and test the circuit board.
A micro-controller is a single integrated circuit, commonly with the following features:
central processing unit - ranging from small and simple 4-bit processors to complex 32- or 64-bit processors volatile memory (RAM) for data storage ROM, EPROM, EEPROM or Flash memory for program and operating parameter storage discrete input and output bits, allowing control or detection of the logic state of an individual package pin serial input/output such as serial ports (UARTs) other serial communications interfaces like I²C, Serial Peripheral Interface and Controller Area Network for system interconnect peripherals such as timers, event counters, PWM generators, and watchdog clock generator - often an oscillator for a quartz timing crystal, resonator or RC circuit many include analog-to-digital converters, some include digital-to-analog converters in-circuit programming and debugging support. This integration drastically reduces the number of chips and the amount of wiring and circuit board space that would be needed to produce equivalent systems using separate chips. Furthermore, on low pin count devices in particular, each pin may interface to several internal peripherals, with the pin function selected by software. This allows a part to be used in a wider variety of applications than if pins had dedicated functions. Micro-controllers have proved to be highly popular in embedded systems since their introduction in the 1970s. Some microcontrollers use a Harvard architecture: separate memory buses for instructions and data, allowing accesses to take place concurrently. Where a Harvard architecture is used, instruction words for the processor may be a different bit size than the length of internal memory and registers; for example: 12-bit instructions used with 8-bit data registers. The decision of which peripheral to integrate is often difficult. The microcontroller vendors often trade operating frequencies and system design flexibility against time-to-market requirements from their customers and overall lower system cost. Manufacturers have to balance the need to minimize the chip size against additional functionality.
Microcontroller architectures vary widely. Some designs include general-purpose microprocessor cores, with one or more ROM, RAM, or I/O functions integrated onto the package. Other designs are purpose built for control applications. A micro-controller instruction set usually has many instructions intended for bit-wise operations to make control programs more compact.[2] For example, a general purpose processor might require several instructions to test a bit in a register and branch if the bit is set, where a micro-controller could have a single instruction to provide that commonly-required function.
Microcontrollers typically do not have a math coprocessor, so floating point arithmetic is performed by software.
Programming environments
Microcontrollers were originally programmed only in assembly language, but various high-level programming languages are now also in common use to target microcontrollers. These languages are either designed specially for the purpose, or versions of general purpose languages such as the C programming language. Compilers for general purpose languages will typically have some restrictions as well as enhancements to better support the unique characteristics of microcontrollers. Some microcontrollers have environments to aid developing certain types of applications. Microcontroller vendors often make tools freely available to make it easier to adopt their hardware. Many microcontrollers are so quirky that they effectively require their own non-standard dialects of C, such as SDCC for the 8051, which prevent using standard tools (such as code libraries or static analysis tools) even for code unrelated to hardware features. Interpreters are often used to hide such low level quirks. Interpreter firmware is also available for some microcontrollers. For example, BASIC on the early microcontrollers Intel 8052;[4] BASIC and FORTH on the Zilog Z8[5] as well as some modern devices. Typically these interpreters support interactive programming. Simulators are available for some microcontrollers, such as in Microchip's MPLAB environment and the Revolution Education PICAXE range. These allow a developer to analyze what the behavior of the microcontroller and their program should be if they were using the actual part. A simulator will show the internal processor state and also that of the outputs, as well as allowing input signals to be generated. While on the one hand most simulators will be limited from being unable to simulate much other hardware in a system, they can exercise conditions that may otherwise be hard to reproduce at will in the physical implementation, and can be the quickest way to debug and analyze problems.
Recent microcontrollers are often integrated with on-chip debug circuitry that when accessed by an in-circuit emulator via JTAG, allow debugging of the firmware with a debugger.
Microcontrollers are used in automatically controlled products and devices, such as automobile engine control systems, implantable medical devices, remote controls, office machines, appliances, power tools, and toys. By reducing the size and cost compared to a design that uses a separate microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally control even more devices and processes. Mixed signal microcontrollers are common, integrating analog components needed to control non-digital electronic systems.
Some microcontrollers may use Four-bit words and operate at clock rate frequencies as low as 4 kHz, for low power consumption (milliwatts or microwatts). They will generally have the ability to retain functionality while waiting for an event such as a button press or other interrupt; power consumption while sleeping (CPU clock and most peripherals off) may be just nanowatts, making many of them well suited for long lasting battery applications. Other microcontrollers may serve performance-critical roles, where they may need to act more like a digital signal processor (DSP), with higher clock speeds and power consumption
Embedded design
A microcontroller can be considered a self-contained system with a processor, memory and peripherals and can be used as an embedded system.[1] The majority of microcontrollers in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for computer systems. These are called embedded systems. While some embedded systems are very sophisticated, many have minimal requirements for memory and program length, with no operating system, and low software complexity. Typical input and output devices include switches, relays, solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer, and may lack human interaction devices of any kind.
Interrupts
Microcontrollers must provide real time (predictable, though not necessarily fast) response to events in the embedded system they are controlling. When certain events occur, an interruptsystem can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR, or "interrupt handler"). The ISR will perform any processing required based on the source of the interrupt before returning to the original instruction sequence. Possible interrupt sources are device dependent, and often include events such as an internal timer overflow, completing an analog to digital conversion, a logic level change on an input such as from a button being pressed, and data received on a communication link. Where power consumption is important as in battery operated devices, interrupts may also wake a microcontroller from a low power sleep state where the processor is halted until required to do something by a peripheral event.
Programs
Microcontroller programs must fit in the available on-chip program memory, since it would be costly to provide a system with external, expandable, memory. Compilers and assemblers are used to convert high-level language and assembler language codes into a compact machine code for storage in the microcontroller's memory. Depending on the device, the program memory may be permanent, read-only memory that can only be programmed at the factory, or program memory may be field-alterable flash or erasable read-only memory.
Other microcontroller features
Microcontrollers usually contain from several to dozens of general purpose input/output pins (GPIO). GPIO pins are software configurable to either an input or an output state. When GPIO pins are configured to an input state, they are often used to read sensors or external signals. Configured to the output state, GPIO pins can drive external devices such as LEDs or motors.
Many embedded systems need to read sensors that produce analog signals. This is the purpose of the analog-to-digital converter (ADC). Since processors are built to interpret and process digital data, i.e. 1s and 0s, they are not able to do anything with the analog signals that may be sent to it by a device. So the analog to digital converter is used to convert the incoming data into a form that the processor can recognize. A less common feature on some microcontrollers is a digital-to-analog converter (DAC) that allows the processor to output analog signals or voltage levels.
In addition to the converters, many embedded microprocessors include a variety of timers as well. One of the most common types of timers is the Programmable Interval Timer (PIT). A PIT may either count down from some value to zero, or up to the capacity of the count register, overflowing to zero. Once it reaches zero, it sends an interrupt to the processor indicating that it has finished counting. This is useful for devices such as thermostats, which periodically test the temperature around them to see if they need to turn the air conditioner on, the heater on, etc.
Time Processing Unit (TPU) is a sophisticated timer. In addition to counting down, the TPU can detect input events, generate output events, and perform other useful operations.
A dedicated Pulse Width Modulation (PWM) block makes it possible for the CPU to control power converters, resistive loads, motors, etc., without using lots of CPU resources in tight timer loops.
Universal Asynchronous Receiver/Transmitter (UART) block makes it possible to receive and transmit data over a serial line with very little load on the CPU. Dedicated on-chip hardware also often includes capabilities to communicate with other devices (chips) in digital formats such as I2C and Serial Peripheral Interface (SPI).
Higher integration
In contrast to general-purpose CPUs, micro-controllers may not implement an external address or data bus as they integrate RAM and non-volatile memory on the same chip as the CPU. Using fewer pins, the chip can be placed in a much smaller, cheaper package.
Integrating the memory and other peripherals on a single chip and testing them as a unit increases the cost of that chip, but often results in decreased net cost of the embedded system as a whole. Even if the cost of a CPU that has integrated peripherals is slightly more than the cost of a CPU and external peripherals, having fewer chips typically allows a smaller and cheaper circuit board, and reduces the labor required to assemble and test the circuit board.
A micro-controller is a single integrated circuit, commonly with the following features:
central processing unit - ranging from small and simple 4-bit processors to complex 32- or 64-bit processors volatile memory (RAM) for data storage ROM, EPROM, EEPROM or Flash memory for program and operating parameter storage discrete input and output bits, allowing control or detection of the logic state of an individual package pin serial input/output such as serial ports (UARTs) other serial communications interfaces like I²C, Serial Peripheral Interface and Controller Area Network for system interconnect peripherals such as timers, event counters, PWM generators, and watchdog clock generator - often an oscillator for a quartz timing crystal, resonator or RC circuit many include analog-to-digital converters, some include digital-to-analog converters in-circuit programming and debugging support. This integration drastically reduces the number of chips and the amount of wiring and circuit board space that would be needed to produce equivalent systems using separate chips. Furthermore, on low pin count devices in particular, each pin may interface to several internal peripherals, with the pin function selected by software. This allows a part to be used in a wider variety of applications than if pins had dedicated functions. Micro-controllers have proved to be highly popular in embedded systems since their introduction in the 1970s. Some microcontrollers use a Harvard architecture: separate memory buses for instructions and data, allowing accesses to take place concurrently. Where a Harvard architecture is used, instruction words for the processor may be a different bit size than the length of internal memory and registers; for example: 12-bit instructions used with 8-bit data registers. The decision of which peripheral to integrate is often difficult. The microcontroller vendors often trade operating frequencies and system design flexibility against time-to-market requirements from their customers and overall lower system cost. Manufacturers have to balance the need to minimize the chip size against additional functionality.
Microcontroller architectures vary widely. Some designs include general-purpose microprocessor cores, with one or more ROM, RAM, or I/O functions integrated onto the package. Other designs are purpose built for control applications. A micro-controller instruction set usually has many instructions intended for bit-wise operations to make control programs more compact.[2] For example, a general purpose processor might require several instructions to test a bit in a register and branch if the bit is set, where a micro-controller could have a single instruction to provide that commonly-required function.
Microcontrollers typically do not have a math coprocessor, so floating point arithmetic is performed by software.
Programming environments
Microcontrollers were originally programmed only in assembly language, but various high-level programming languages are now also in common use to target microcontrollers. These languages are either designed specially for the purpose, or versions of general purpose languages such as the C programming language. Compilers for general purpose languages will typically have some restrictions as well as enhancements to better support the unique characteristics of microcontrollers. Some microcontrollers have environments to aid developing certain types of applications. Microcontroller vendors often make tools freely available to make it easier to adopt their hardware. Many microcontrollers are so quirky that they effectively require their own non-standard dialects of C, such as SDCC for the 8051, which prevent using standard tools (such as code libraries or static analysis tools) even for code unrelated to hardware features. Interpreters are often used to hide such low level quirks. Interpreter firmware is also available for some microcontrollers. For example, BASIC on the early microcontrollers Intel 8052;[4] BASIC and FORTH on the Zilog Z8[5] as well as some modern devices. Typically these interpreters support interactive programming. Simulators are available for some microcontrollers, such as in Microchip's MPLAB environment and the Revolution Education PICAXE range. These allow a developer to analyze what the behavior of the microcontroller and their program should be if they were using the actual part. A simulator will show the internal processor state and also that of the outputs, as well as allowing input signals to be generated. While on the one hand most simulators will be limited from being unable to simulate much other hardware in a system, they can exercise conditions that may otherwise be hard to reproduce at will in the physical implementation, and can be the quickest way to debug and analyze problems.
Recent microcontrollers are often integrated with on-chip debug circuitry that when accessed by an in-circuit emulator via JTAG, allow debugging of the firmware with a debugger.
Subscribe to:
Posts (Atom)