728x90

728x90

Showing posts with label PIC16F630. Show all posts
Showing posts with label PIC16F630. Show all posts

Friday, July 11, 2025

DIY PICMicro Low Pin Count DIP Prototype Board

Overview 

Using a prototype board for micro-controller firmware testing could save time and safer. Putting an on-board device programmer with prototype board could be more satisfy for electronic hobbyists.

I have some PIC18 and PIC16 series of micro-controllers left from previous projects. I don't know what to do with them anymore. So I put them on single board to PIC program testing next time I need them without checking their pin diagram, and wiring them on bread board. 

DIY PICMicro Low Pin Count DIP Prototype Board
PCB Front View

DIY PICMicro Low Pin Count DIP Prototype Board
PCB Back View
 

I designed a PCB with a 

  1. PICKit2 device programmer (with AVR ISP header)
  2. +5VDC and +3.3VDC low drop out power supply
  3.  RS-232 to TTL logic converter
  4. I2C DS1307 RTC and 24LC08 EEPROM 
  5. 4-bit LCD (HD4478)
  6. 3-digit 056'common cathode multiplexing display 
  7. One passive buzzer with transistor driver (using CCP1 PWM output pin of PIC16F876A)
  8. 8-LED that connects to PORTC of PIC16F876A
  9. A 4x4 keypad matrix that connects to PORTB of PIC16F876A
  10. Three analog inputs (one LM35 and two potentiometers) that connect to RA0...RA1 of PIC16F876A. 
  11. A 28-pin IC socket for 28-pin PIC devices
  12. A 20-pin IC socket for 20-pin PIC devices
  13. A 18-pin IC socket for 18-pin PIC devices
  14. A 14-pin IC socket for 14-pin PIC devices
  15. And a 8-pin IC socket for 8-pin PIC devices

This board seem to be a large PCB with two copper layer near a size of an A4 paper that I'm not yet fabricate it. It need a PCB fabrication service.

Schematic

I use Protues VSM Release 8.16 SP3 to design draw its circuit diagram. Some components are not in its original libraries. So I find and download some devices symbol, footprints and 3D objects from snapeda website. I separate its schematic into A4 sheets. 



DIY PICMicro Low Pin Count DIP Prototype Board
Sheet #1

DIY PICMicro Low Pin Count DIP Prototype Board
Sheet #2

DIY PICMicro Low Pin Count DIP Prototype Board
Sheet #3

DIY PICMicro Low Pin Count DIP Prototype Board
Sheet #4

DIY PICMicro Low Pin Count DIP Prototype Board
Sheet #5

This board could fit,

  1. 28-pin PIC microcontrollers: PIC16F876A, PIC16F886, etc.
  2. 20-pin PIC microcontrollers: PIC16F1459(USB), PIC16F690, etc.
  3. 18-pin PIC microcontrollers: PIC16F1827, PIC16F84A, PIC16F818, etc.
  4. 14-pin PIC microcontrollers: PIC16F630, PIC16F676, etc.
  5. 8-pin PIC microcontrollers: PIC12F629, PIC12F675, PIC12F683, etc.

These are some mid-range PIC micro-controllers I have at my own workshop.

Printed Circuit Board (PCB)

This board size is 8.02x6.30 inches that could be a little bit expensive to order from any professional PCB fabrication service. But if we need to use it with classmate or friend the share cost is cheaper.

DIY PICMicro Low Pin Count DIP Prototype Board
Top Copper non-mirror


DIY PICMicro Low Pin Count DIP Prototype Board
Bottom Copper


DIY PICMicro Low Pin Count DIP Prototype Board
Top Silk

I preview this PCB on an online Gerber viewer software.

DIY PICMicro Low Pin Count DIP Prototype Board
Gerber View Top Copper

DIY PICMicro Low Pin Count DIP Prototype Board
Gerber View Bottom Copper


 Click here to download its design file.


PCB Fabrication

I have been using PCBWay for many years now. PCBWay fabricate PCBs at low cost, fast processing time for only 24 hours, and fast delivery time using any carrier options. This double side 10cmx10cm can be fabricate at only 5USD for 5 to 10pcs by PCBWay. It's a standard PCB with silk screen and solder mask.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
10 PCBs for only 5USD
 

For different size of PCB we can instantly quote on PCBWay website using a zip PCB Gerber file without account.


A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PCBWay Instant Quote
 

We can accurately see the preview of fabricated PCB generated by the company's online Gerber file viewer.

PCBWay also offer PCBA assembly service at reasonable price.

A DIY dsPIC30F2010 and dsPIC30F1010 Prototype Board with Programmer
PCBWay PCB Assembly Service


Tuesday, August 25, 2020

Reading And Displaying The Temperature From DS18S20 Using PIC16F630

The PIC16F630

PIC16F630 is an 8-bit PICMicro released a decade a go. I bought a dozen of it for a simple project at a company at that time. So fa, I still have them left in my components storage box.


It's a 14-pin device with a DIP package enable good choice for hobbyist prototyping. The device typically supplied from 2.0 V to 5.5 V, normally 5 V is preferred for most peripheral device interfacing.


The program memory is 1024 words, with 64 bytes of internal SRAM. The auxiliary non-volatile memory EEPROM is 128 bytes.


It could clock up to 20 MHz. However with ease of prototyping and spacing saving, we can use it's internal RC oscillator that could clock up to 4 MHz with 1% error.


In this example, reading a temperature from one-wire device and just making a display, selecting this device is more economics.

The DS18S20 1-Wire Digital Temperature Sensor

DS18S20 is digital thermometer come with only three pins, two supply pin and one bi-directional data pin.


Reading And Displaying The Temperature From DS18S20 Using PIC16F630
DS18S20 sample picture an pin diagram

The device comes with both TO-92 and SMD package. A TO-92 is preferred for most student and hobbyist prototyping.


Temperature resolution is 9-bit. The temperature conversion ranges from -55 to +125 degree Celsius. The result includes one bit of fraction with the fraction number of 0.5 degree Celsius.


It needs a DC supply voltage from 3.0 V to 5.5 V. The data DQ pin is open-drain, thus requires a pull up resistor with the resistance from 4.7 to 10 kOhm depending on the wire length. 


One-wire protocol made by the manufacturer requires a good embedded programming skill. It needs a precise timing, and there a lot of device command such as a Skip ROM and a Read Scratchpad command.


For a single device connection, the reading process is simpler. A single DS18S20 device temperature reading flow list below.


A screen shot from device datasheet. Here there's a single DS18S20 connected on the bus.

For timing diagram and data transfer criteria, please check its datasheet on the web.

CCS PICC Programming And Interfacing

CCS PICC includes a driver for one-wire device reading. It works with DS1820, DS18S20 and DS18B20 1-wire device.

CCS PICC 1-Wire Driver

The touch.c contains many function to work with 1-wire device.

  • data = touch_read_bit()     Reads one bit from a touch device                                                                   
  • data = touch_read_BYTE()    Reads one byte from a touch device.                                                           
  • ok = touch_write_bit(data)  Writes one bit to a touch device and returns true if all went ok. A false indicates a collision with   another device.                                                                                                                                                                                 
  • ok = touch_write_byte(data) - Writes one byte to a touch device and returns true if all went ok. A false indicates a collision with  another device.                                                                                                                                                                              
  • present = touch_present()  - Issues a reset and returns true if the touch device is there.                                                
  • reset_pulse() - Issues a reset and waits for a present pulse.   

Programming And Circuit Simulation

I planned the circuit requirement as per in the schematic.

Reading And Displaying The Temperature From DS18S20 Using PIC16F630
Schematic Diagram

CCS PICC program lists below.



#include<16f630.h>
#fuses INTRC_IO,NOMCLR
#use delay(clock=4000000)

#define TOUCH_PIN  PIN_A5

#include<touch.c>

#define LCD_ENABLE_PIN  PIN_C1                                    
#define LCD_RS_PIN      PIN_A0                                    
#define LCD_RW_PIN      PIN_C0                                    
#define LCD_DATA4       PIN_C2                                    
#define LCD_DATA5       PIN_C3                                    
#define LCD_DATA6       PIN_C4                                    
#define LCD_DATA7       PIN_C5     

#include<LCD.c>

byte buffer[2];
byte tempDecimal,tempFraction;

void temperatureRead(void){
   if(touch_present()) {
         //Skip ROM
        touch_write_byte(0xCC);
        //Convert T
        touch_write_byte (0x44);
        output_high(TOUCH_PIN);
        delay_ms(1000);

        touch_present();
        //Skip ROM
        touch_write_byte(0xCC);
        //Read Scratchpad
        touch_write_byte (0xBE);
        //LSB
        buffer[0] = touch_read_byte();
        //MSB
        buffer[1] = touch_read_byte();
    
     }
}

void main() {
    
   setup_comparator(NC_NC_NC_NC);
   lcd_init();
  
   lcd_gotoxy(1,1);
   printf(LCD_PUTC,"  Temperature:  ");
   temperatureRead();
   delay_ms(1000);
   while (TRUE) {
     
     temperatureRead();
     tempDecimal=buffer[0]>>1;
     tempFraction=buffer[0]&0x01;
       
     if(buffer[1]==0xFF) tempDecimal=(~buffer[0]>>1)+1;
     if(tempFraction==0x01) tempFraction=5;
     else tempFraction=0;
 
     lcd_gotoxy(1,2);
     printf(LCD_PUTC,"  %c%d.%d %cC ",buffer[1]?'-':' ',tempDecimal,tempFraction,223);
  }
}
The simulation screen shot lists below.

Reading And Displaying The Temperature From DS18S20 Using PIC16F630
Simulation Screen Shot

Example archive could be download here.





320x50

Search This Blog

Labels

25AA010A (1) 8051 (7) 93AA46B (1) ADC (30) Analog Comparator (1) Arduino (15) ARM (6) AT89C52 (7) ATMega32 (57) AVR (58) CCS PICC (28) DAC (1) DHT11 (2) Display (106) Distance Sensor (3) DS18B20 (3) dsPIC (3) dsPIC30F1010 (3) dsPIC30F2010 (1) EEPROM (5) Environment Sensor (4) esp8266 (1) I2C (29) Input/Output (68) Interrupt (19) Keil (5) Keypad (10) LCD (48) Master/Slave (1) MAX7221 (1) MCP23017 (5) MCP23S17 (4) Meter (3) MikroC (2) Motor (15) MPLABX (73) Nokia 5110 LCD (3) OLED (2) One-Wire (6) Oscillator (8) PCB (10) PCD8544 (3) PCF8574 (5) PIC (108) PIC12F (3) PIC16F628A (3) PIC16F630 (2) PIC16F716 (4) PIC16F818 (11) PIC16F818/819 (3) PIC16F84A (16) PIC16F876A (2) PIC16F877A (9) PIC16F88 (2) PIC16F887 (60) PIC18 (19) PIC18F1220 (5) PIC18F2550 (5) PIC18F4550 (12) PICKit2 (1) PWM (11) RTC (9) Sensor (11) SH1106 (1) Shift Register (11) Shift Registers (3) SPI (24) STM32 (6) STM32 Blue Pill (6) STM32CubeIDE (6) STM32F103C8T6 (6) SysTick (3) temperature sensor (11) Thermometer (21) Timer/Counter (31) TM1637 (2) UART (7) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (96)

tyro-728x90