Entering the AVR

Source: Internet
Author: User
Order:

Previously, we used the stc51 + feisikar xs128 combination, which is simple to write with 51, and complicated to use xs128. For the AVR, PIC, and STM series, we only heard their voices and did not see anyone. Recently, the first contact with the AVR was started due to the use of the electromagnetic magnetic field generator of the flykar system.

To put it simply, there are internal pull-up resistors, 30ma pull-up current and fill current on the pin, PWM and ADC on the internal hardware, and the price is not expensive. I officially decided to use atmege8 instead of 51.

Port Operations:

The AVR port is a real two-way port, unlike the 51 pseudo two-way port. This is also an advantage of AVR, but you can pay attention to ddrn during operations. Real bidirectional ports are not as convenient as pseudo bidirectional ports in analog timing.
Ddrn portn PINN explanation: n is the port number: ABCDE
Ddrn: whether the control port is input or output. 0 indicates input, and 1 indicates output. Personal memory method: it is bigger than zero, so it is crowded out, that is, 1 is the output, 0 is the input.
Portn: output signal from the pin. When ddrn is 1, you can assign values to the output through port operation statements such as portn = x.
PINN: Read the input signal from the pin, regardless of ddrn value, the external level of port N can be obtained through X = PINN.

Description of ddxn portxn pud (in sfior) I/O pull-up Resistance
0 0 X Input no high impedance (hi-Z)
0 1 0 input Yes output current when the external circuit is low
0 1 1 input no high impedance (hi-Z)
1 0 x output no output low level (leakage current)
1 1 x output no output high (pulling current)

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.