---
# System prepended metadata

title: Microchip study
tags: [Microchip]

---

# Microchip study
- [time=Feb 7, 2022 14:22 PM]
-  [color=#69e0e0] [name=Huang, Hsien-Chun ]
- [TOC] 
###### tags: `MCU` `Microchip` 
## PIC16F1509
- 8 bit
- 內部振盪器 16M
- Operating Voltage Range:
- 1.8V to 3.6V (PIC16LF1508/9)
- 2.3V to 5.5V (PIC16F1508/9)
- Analog-to-Digital Converter (ADC): 10-bit resolution

## Set OSCILLATOR 
- 可分位外部震盪、內部震盪
- ECL:External Clock Low-Power mode:
-- (0 MHz to 0.5 MHz)
- ECM:External Clock Medium Power mode:
-- (0.5 MHz to 4 MHz)
- ECH:External Clock High-Power mode:
-- (4 MHz to 20 MHz)
-  LP : 32 kHz Low-Power Crystal mode
-  XT :Medium Gain Crystal or Ceramic Resonator
Oscillator mode (up to 4 MHz)
- HS  : High Gain Crystal or Ceramic Resonator
--  (4 MHz to 20 MHz)
- EXTRC  : External Resistor-Capacitor
- INTOSC : Internal oscillator (31 kHz to 16 MHz)
----------------------------------------
- FOSC<2:0>: Oscillator Selection bits
```
111 = ECH:External clock, High-Power mode: on CLKIN pin
110 = ECM: External clock, Medium Power mode: on CLKIN pin
101 = ECL: External clock, Low-Power mode: on CLKIN pin
100 = INTOSC oscillator: I/O function on CLKIN pin
011 = EXTRC oscillator: External RC circuit connected to CLKIN pin
010 = HS oscillator: High-speed crystal/resonator connected between OSC1 and OSC2 pins
001 = XT oscillator: Crystal/resonator connected between OSC1 and OSC2 pins
000 = LP oscillator: Low-power crystal connected between OSC1 and OSC2 pins
```
- INTERNAL CLOCK SOURCES
- HFINTOSC :High-Frequency Internal
Oscillator at 16 M
-- IRCF<3:0> bits of the OSCCON
-- FOSC<2:0> = 100
-- Set the System Clock Source (SCS) bits of the
OSCCON register to ‘1x’.
- LFINTOSC : Low-Frequency Internal
Oscillator at 31 kHz.
-- IRCF<3:0> bits of the OSCCON
-- The LFINTOSC is also the frequency
for the Power-up Timer (PWRT), Watchdog Timer
(WDT) and Fail-Safe Clock Monitor (FSCM).
-- Set the System Clock Source (SCS) bits of the
OSCCON register to ‘1x’.
-----
- OSCCON: OSCILLATOR CONTROL REGISTER
- ![](https://i.imgur.com/jBUTF1K.png)

```
- bit 7 Unimplemented: Read as ‘0’
- bit 6-3 IRCF<3:0>: Internal Oscillator Frequency Select bits
    1111 = 16 MHz
    1110 = 8 MHz
    1101 = 4 MHz
    1100 = 2 MHz
    1011 = 1 MHz
    1010 = 500 kHz(1)
    1001 = 250 kHz(1)
    1000 = 125 kHz(1)
    0111 = 500 kHz (default upon Reset)
    0110 = 250 kHz
    0101 = 125 kHz
    0100 = 62.5 kHz
    001x = 31.25 kHz
    000x = 31 kHz LF
- bit 2 Unimplemented: Read as ‘0’
- bit 1-0 SCS<1:0>: System Clock Select bits
    1x = Internal oscillator block
    01 = Secondary oscillator
    00 = Clock determined by FOSC<2:0> in Configuration Words.
```
- ![](https://i.imgur.com/r9LGn9a.png)
----------------------------------------
## WATCHDOG TIMER (WDT)
- ![](https://i.imgur.com/o5wGPbK.png)
- ![](https://i.imgur.com/dS0uSQF.png)
- ![](https://i.imgur.com/40TEBZd.png)
- ![](https://i.imgur.com/tQfleTz.png)
----------------------------------------
## I/O PORTS
- TRISx 
- PORTx
- LATx
- ![](https://i.imgur.com/bjfd9Tv.png)
- PORTA Registers
-- 6-bit wide
-- Set TRISA =1 PORTA pin an input
-- Set TRISA =0 PORTA pin an output
-![](https://i.imgur.com/WjGyxu6.png)
-- : Writes to PORTA are actually written to corresponding LATA register. Reads from PORTA register is return
of actual I/O pin values
-- ![](https://i.imgur.com/KtcuHQ5.png)
-- ![](https://i.imgur.com/fsaDCjG.png)
- PORTB Registers
-- 4-bit wide 
-- Set TRISB =1 PORTA pin an input
-- Set TRISB =0 PORTA pin an output
-- ![](https://i.imgur.com/nN5r8Uv.png)
--![](https://i.imgur.com/h6cW6UE.png)
- PORTC Registers
-- 8-bit wide 
-- Set TRISC =1 PORTA pin an input
-- Set TRISC =0 PORTA pin an output
![](https://i.imgur.com/9Wsm8Ty.png)
-----------------------------------------
## ADC
----------------------------------------
## Timer
----------------------------------------
## Uart
----------------------------------------
## 參考資料
- [參考1](https://superuser.com/questions/226689/how-can-i-connect-via-ssh-putty-to-my-vmware-machine-ubuntu)
- [參考2](https://kanchengzxdfgcv.blogspot.com/2015/10/putty-windows-ubuntu-oracle-vm.html)



