Starting from the IO port_HCS12 study notes (1)

Publisher:科技思想家Latest update time:2015-11-13 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Many IO ports have multiplexing functions. At the beginning, I only learned about the input and output to complete the functions of the keyboard and display. I used the DEMO of the experimental board DP256. The display was a small LED light and the keyboard was a switch.
A, B, E, and K can control whether to pull up the resistor through the register, and they share an enable bit PUCR.
 
H, J, M, P, S, and T can also be used as ordinary IO ports, which are basically similar to port A.
 
1.1 Output
The program uses the output of PORTB to control the brightness of the small light. Setting DDRB to high enables the output of port B, which is the initialization of the IO port. The value of PORTB is used to control the initial brightness of the small light.
 
The software can be used to control the order in which the small lights light up and other functions.
 
1.2 Input
Same as above, DDR becomes low for input. Here, in order to realize the keyboard, the IO port is set to pull up, which is high level when it is not connected. The IO port can also set interrupts, which are not used here, and no relevant information has been found, so it is left blank for now.
 
 
 
General register table, taking port H as an example:
 
 
 
Data Direction Register DDRH
 
IO port register PTH
 
When the input register PTIH pin is input, the value is the corresponding level. When output, monitor whether the pin is overloaded or short-circuited, and the value is 1.
 
Low power drive register RDRH
 
Pull-up and pull-down enable register PERH
 
Pull-up and pull-down selection register PPSH 0 is pull-up, 1 is pull-down
 
 
 
The initial understanding of embedded systems also needs to start with the simplest examples, such as small lights and keyboards. The development board I use is Motorola's HCS12dp256b demo board. The keyboard only has an eight-bit switch corresponding to port H, and the LED light is also the simplest, corresponding to port B. What is easy to make mistakes in the beginning is the hardware, whether the light is 1 or 0, or whether the switch direction is 1 when it is on or 1 when it is off. On my board, the switch is closed to 0, and I couldn't get it right at the beginning because I didn't understand this aspect. Finally, after pulling up the switch port (H), the problem was solved.
 
Reference address:Starting from the IO port_HCS12 study notes (1)

Previous article:FLASH debugging_HCS12 study notes (6)
Next article:HCS12 interrupt vector table

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号