Case

PMS150C PADAUK single-chip microcontroller builds a simple blinking bicycle light development cas

I used PADAUK PMS150C to construct a simple blinking bicycle light. This is a simple project that uses a tactile button switch to turn on or off the blinking LED, which could be used as a bicycle light.

PMS150C PADAUK single-chip microcontroller builds a simple blinking bicycle light development cas(图1)

General OTP series
It is not recommended to be used in applications with AC resistance-capacitance step-down power supply or high EFT requirements.
Operating temperature range: -40 °C ~ 85 °C

System features

  1. 1KWOTP program storage

  2. 64 Bytes of data storage

  3. One 16-bit timer

  4. One 8-bit timer (can be used as a PWM generator)

  5. One general comparator

  6. Fast wake-up function

  7. Each IO pin can be set to wake-up function

  8. Six IO pins with pull-up resistors, and the output has optional current driving capability

  9. Clock source: internal high-frequency oscillator, internal low-frequency oscillator

  10. Eight sections of LVR are optional

  11. One external interrupt pin


CPU features

  1. Single processing unit operating mode

  2. Provide 79 effective instructions

  3. 1T (single cycle) instruction

  4. Programmable stack pointer and stack depth

  5. Data access supports direct and indirect addressing modes, and the data memory can be used as the data pointer (index pointer) of the indirect addressing mode

  6. Independent IO address and storage address space


Some common mistakes that users should avoid when using PMS15A/PMS150C

IO use and setting

(1) When IO is used as a digital input
When IO is used as a digital input, the levels of Vih and Vil will vary with voltage and temperature, please follow the minimum value of Vih and the maximum value of Vil specification.
The internal pull-up resistor value will vary with voltage, temperature, and pin voltage, and is not a fixed value.

(2) When IO is used as a digital input and the wake-up function is turned on
Set IO to input.
Use the PADIER register to set the corresponding bit to 1.
In order to prevent leakage current from those unused IO ports in PA, PADIER [1: 2] needs to be permanently set to 0.

(3) PA5 as output
PA5 can only be used as OpenDrain output, and extra pull-up resistors are required for high output.

(4) PA5 as PRSTB input
Set PA5 as input.
Set CLKMD.0 = 1 to make PA5 the external PRSTB input pin.

(5) PA5 as input and connected to a button or switch through a long wire
It is necessary to string a > 33 ohm resistor between PA5 and the long wire.
PA5 should be used as input as little as possible.

Interrupt

(1) The general steps for using the interrupt function are as follows:
Step 1: Set the INTEN register to enable the control bits of the required interrupt.
Step 2: Clear the INTRQ register.
Step 3: In the main program, use the ENGINT instruction to allow the CPU's interrupt function.
Step 4: Wait for the interrupt. After the interrupt occurs, jump to the interrupt subroutine.
Step 5: After the interrupt subroutine is executed, return to the main program.

  • In the main program, the DISGINT instruction can be used to turn off all interrupts.

  • When jumping into the interrupt subroutine for processing, the PUSHAF instruction can be used to save the ALU and FLAG register data, and before RETI, the POPAF instruction can be used to restore. The general steps are as follows:
    void Interrupt (void) // After the interrupt occurs, jump to the interrupt subroutine,
    { // Enter the state of DISGINT automatically, and the CPU will no longer accept interrupts
    PUSHAF;
    POPAF;
    } //


The system automatically fills in RETI, and it will not automatically return to the ENGINT state until the execution of RETI is completed

(2) INTEN and INTRQ have no initial value, so the required values must be set before using the interrupt.

Switching the system clock
The system clock source can be switched using the CLKMD register. However, it must be noted that the original clock source cannot be turned off while switching the system clock source. For example:
When switching from clock source A to clock source B, the system clock source should be switched using the CLKMD register first, and then the clock source oscillator of A can be turned off through the CLKMD register.

Example: Switching the system clock from ILRC to IHRC / 2
.CLKMD = 0x36; // Switch to IHRC, but do not disable ILRC.
CLKMD.2 = 0; // Only then can the ILRC be turned off.

Wrong way of writing: Switching from ILRC to IHRC and simultaneously turning off ILRC
.CLKMD = 0x50; // The MCU will crash.

Power-down mode, wake-up, and watchdog
When the ILRC is turned off, the watchdog will also fail.

TIMER16 overflow time
When the $INTEGSBIT_R is set (this is the default value of the IC) and the T16M counter BIT8 generates an interrupt, if the T16 count starts from 0, the first interrupt occurs when the count reaches 0x100 (BIT8 changes from 0 to 1), and the second interrupt occurs when the count reaches 0x300 (BIT8 changes from 0 to 1). So setting BIT8 is to interrupt after counting 512 times. Please note that if the T16M counter is reset in the interrupt, the next interrupt will also occur when BIT8 changes from 0 to 1. If the $INTEGSBIT_F (BIT trigger from 1 to 0) is set and the T16M counter BIT8 generates an interrupt, the T16 count is changed to occur when counting to 0x200/0x400/0x600/... each time. Each of the two settings of INTEGS has its own advantages, and also note the differences therein.

IHRC
(1) When the IC is programmed in the programmer, the IHRC frequency will be calibrated.
(2) Due to the characteristics of EMC or during IC packaging or COB, it will affect the IHRC frequency to varying degrees. If the frequency calibration has been completed before IC encapsulation, the actual IHRC frequency may deviate or exceed the specification after IC encapsulation. Usually, the frequency will slow down slightly.
(3) Usually, the situation described above occurs during COB sealing or QTP, and Padauk Technology is not responsible for anything.
(4) Users can make frequency compensation according to their usage experience, for example, users can increase the IHRC frequency by about 0.5% to 1% when using it to obtain a better IHRC frequency after IC encapsulation.


Categories

News

Contact Us

Contact: Tianheng Technology

Phone: +8613265876004

Tel: +8675583041117

E-mail: jaycha5574842@qq.com

Add: Shenzhen City, Guangdong Province, China