Skip to main content

Posts

Temperature Controller

This code is tested on Pic 16f876 This code essentially creates a system that continuously monitors the temperature using an ADC and adjusts a heater to maintain the temperature within a specified range. It's commonly used in applications where precise temperature control is required, such as in incubators, ovens, or climate control systems. These comments should help you understand the functionality of the code better. Here is the code -------------------------------------------------------------------- #include <pic.h> // Include the PIC header file unsigned int a2d_value; // Variable to store the ADC value void main() {     TRISA = 0xFF;    // Configure Port A as input     TRISC = 0;       // Configure Port C as output     ADCON0 = 0B01000001; // ADC configuration: Fosc/8, RA0 input, ADC On     ADCON1 = 0B10001110; // ADC configuration: Right justify, RA0 analog (Vdd/Vss reference)     OPTION = 0x07...
Recent posts

Counter

This code is tested on Pic 16f876 This code appears to be for a simple counting mechanism, where a value is incremented each time a certain input condition is met (RB7 is high). The count value is displayed on a seven-segment display, and it resets after reaching 10. Code For counter  -------------------------------------------------------------- #include <pic.h>  // Include the header file for PIC microcontrollers #define _XTAL_FREQ 4000000  // Define the crystal frequency to be 4 MHz unsigned char count;  // Declare an 8-bit variable to store the count value unsigned char PORTB_value[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};  // Define an array to hold values for displaying digits 0-9 on a 7-segment display void main() {     TRISA=0;          // Configure all pins of PORTA as output     ADCON1=0x07;      // Configure PORTA pins as digital I/O     TRISB=0x80;   ...

Voltmeter

This code to read an analog temperature sensor, convert the reading to a digital value using the ADC, and display the temperature on a 4-digit 7-segment display. The display is updated periodically based on a timer interrupt. 1.Initialization: Setting up ports, configuring ADC, and Timer0. 2.Infinite Loop: Continuously reads analog input and updates the display. 3.ADC Conversion: Reads analog voltage from a sensor. 4.Voltage Calculation: Converts ADC value to voltage. 5.Digit Extraction: Extracts individual digits from the temperature/voltage value. 6.Display Function: Displays the digits on a 4-digit 7-segment display with slight delays. --------------------------------------------- #include <pic.h> // Include the header file for PIC microcontroller family. unsigned char PORTB_value[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F}; // Array containing values for 7-segment display. unsigned int a2d_value,temp; // Variables for analog to digital conversion and temporary sto...

Installing and Configuring Fortinet VM in VMware Workstation

For excrement I was try to paly with office firewall but I felt it is risky then I found the vm version of the firewall So I have tried to install it on VM and I am sharing it here now. Firstly, install VMweare workstation Then I have downloaded the firewall image from Fortinet web site, if you need it I can share it with you. After open the VM get the image OS to it And select only one Ethernet interface for it Also verify the Ip address of the VMware interface to adding   the IP to firewall image User name is admin and use blank for for password So we can configure the port now                 Show system interface                 Config system nterface     Edit port1     Setip 192.168.12.200/255.255.255.0     Set allowaccess http https ssh ping fgfm telnet...

PWM effect Pic 16F628A

ANALOGUE to DIGITAL (A/D) Converter in PIC16F87X Series

ANALOGUE to DIGITAL (A/D) Converter What is a Sample & Sample rate? A "sample" is a single measurement of amplitude. Sample rate is simply the number of samples (or measurements of amplitude) taken per second. Sampling Intervals Quantization The samples are assigned a binary number approximating their sampled value. Quantizing divides up the sampled voltage range into 2n-1 quantizing intervals, where “n” is the number of bits per sample (the sampling resolution). For example, an 8-bit system can identify 28 (256) discrete sampled signal values (255 quantizing intervals). The amplitude of such a signal can occupy the entire quantizing range. A/D Reference Voltages Successive Approximation A/D Example 1 Example 2  Example 3 A/D Converter Modules in PIC16F87X series 28-pin devices has 5 modules. (AN0-AN4)         PIC16F873        PIC16F876 4...

Pic 16F876A PWM

Trying PWM with PIC 16F876A PIC 16F876A