Showing posts with label kicad. Show all posts
Showing posts with label kicad. Show all posts

Thursday, September 11, 2008

Make MCU Board - Thermometer (DS1821) module


The reason of choosing DS1821 thermo sensor is that the circuit is very simple, it only need on  IO pin.

Originally, I wrote the test program by SDCC compiler, the test has some problem, the LCD display is work, but the temperature is still display zero?
Then, I did compiling by HI-TECH's PICC, the temperature value is correct.
If you are using PICC, please comment out lines as following:

typedef unsigned int config;
config at 0x2007 __CONFIG = _XT_OSC & _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_OFF;

Replace pic/pic16f877a.h by htc.h

Circuit schematics is as following:












Main process:
/*******************************************************************************

 Copyright (c) 2008 Wizign Ltd.
 All Rights Reserved.

 main.c: Main program for demo thermometer

 Version: 1.0.0

 Date: Sep 05, 2008

 Author: YenHung Chen

 E-mail: yhchen@wizign.com

 Revision:
 ---------- -----------------------------------------------------------------
 2008/09/05 Created by YenHung Chen, demo thermometer for both 8051 and PIC

******************************************************************************/
/*******************************************************************************

The IO control

<>For AT89S52

LCD display:
There are 8 data pins, which are connected P2.
The control pins are connected to P1_0, P1_1, and P1_2.

DS1821:
P1_7

<>For PIC16F877A

LCD display:
There are 8 data pins, which are connected PORTD
The control pins are connected to RA0, RA1, and RA2.

DS1821:
RA5


******************************************************************************/

#include "global.h"
#include "delay.h"
#include "lcd.h"
#include "thermo.h"

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// define IO and global variables

#ifdef MCU_PIC

// Configurations
typedef unsigned int config;
config at 0x2007 __CONFIG = _XT_OSC & _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_OFF;

#endif


//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// define functions

/* Initilize parameters before run the main loop */
void InitParams(void)
{

LCDInit();
ThermoInit();
}

/* Display message on LCD panel */
void DisplayTemperature(void)
{
char tmMsg[16];
int theT;
unsigned char myT;
int hundred;
int tenth;
int ones;

LCDGoto(0); // goto 1st line
LCDPuts("  WIZIGN LTD.  ");

// Convert value to string
myT = ThermoReadTemperature();
if(myT > 127){
   theT = (int)(myT - 0xFF);
}else{
   theT = (int)myT;
}
// start
// it can not display correct format in this block
BLOCK
// end
   hundred = (int)(theT/100);
   tenth = (int)((theT%100)/10);
   ones = theT%10;
   tmMsg[1] = 0x30 + hundred;
   tmMsg[2] = 0x30 + tenth;
   tmMsg[3] = 0x30 + ones;
   tmMsg[4] = 0x20;
   tmMsg[5] = 'C';
   tmMsg[6] = 0x20;
   tmMsg[7] = '\0';

   LCDGoto(0x40); // goto 2nd line
   LCDPuts(tmMsg);
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// main program

void main(void)
{
   // Initilize parameters
 InitParams();

   /* do loop */
   while(1){
    DisplayTemperature();
       // The LCD display and the calculation of time
       // will consume times, so, the delay time is less than 1000 ms.
       DelayMs(900);
   }
}

Wednesday, September 3, 2008

Make MCU Board - EDA Tool - KiCAD


When we design functional MCU module, the circuit schematics is necessarily step for checking IO port.

Except OrCAD and Protel, there are some open source EDA tools.

KiCAD is an open source (GPL) software, we can use KiCAD to design circuit schematics and layout PCB, the author of KiCAD is Jean-Pierre Charras( a research of LIS,Laboratoire des Images et des Signaux, in Frence, he is a electronics and image processing teacher in IUT de Saint Martin d'Hères), he design and coding the KiCAD software.

KiCAD is a composite tools, it includes a project management and 4 specially functional software:

* Eeschema : Design circuit schematics
* Pcbnew : Design PCB
* Gerbview : GERBER viewer
* Cvpcb : For selecting electronic components, while designing circuit.
* Kicad:Project management

KiCAD can use Wings 3D to simulate 3D PCB.

KiCAD does not only run on Windows OS, it can run on Linux, too.

For Fedora Core 9:

# yum install kicad

For Ubuntu 8.04

# apt-get install kicad


The GUI of KiCAD is as following:

Kicad












eeschema












cvpcb











pcbnew












3D simulation












The functions of KiCAD is complete, try it!
If you are software developer, you can download the source code from the official site.