Menu

Adskeeper - header widge

728x90

Search This Blog

468x60

Navbar

AdsKeeper - IAB Display Standard Ad Unit

Monday, October 12, 2026

dsPIC30F2010 SPI Display 5VDC DVM using MikroC

In previous example, I use the SPI module of the dsPIC30F2010 to control a serial LED display and seven-segment display. Now let put them together making a serial display digital volt-meter.

 

dsPIC30F3011 SPI Display 5VDC DVM using MikroC
ADC Reading 

 

There is one on-board POT so I use it to adjust input voltage that varies between 0 and +5VDC. It will show the reading voltage on a serial seven-segment display.

Schematic: 

dsPIC30F2010 SPI Programming Example in MikroC
Schematic Diagram

This is just schematic using device symbols. I can not be simulated like other build-in models. I download the dsPIC30F2010 symbol from SnapEDA for free. 

 

MikroC Source Code: 



  1. // Chip Select Pin
  2. sbit Chip_Select at LATE3_bit;
  3. sbit Chip_Select_Direction at TRISE3_bit;

  4. void SN74595_Send(char _data){
  5. SPI_Write(_data); // Send high byte via SPI
  6. Chip_Select = 0; // Select SPI chip
  7. Chip_Select = 1; // Deselect SPI chip
  8. }

  9. // Common Cathod Segment Data
  10. const char cc[16]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,
  11. 0x7F,0x6F,0x77,0x7C,0x58,0x5E,0x79,0x71};

  12. void show_number(char number){
  13. SN74595_Send(~cc[number]);
  14. }



  15. void main() {
  16. unsigned int temp_res;
  17. float voltage=0;
  18. char digit=0;
  19. Chip_Select = 1; // Deselect DAC
  20. Chip_Select_Direction = 0; // Set CS# pin as Output
  21. SPI1_Init(); // Initialize SPI module
  22. TRISB = 0xFFFF; // PORTB is input
  23. TRISD = 0; // PORTD is output
  24. TRISF = 0; // PORTF is output
  25. ADC1_Init(); // Enable ADC module
  26. while(1){
  27. temp_res = ADC1_Read(4); // Get 10-bit results of AD conversion
  28. voltage = (5.0 * temp_res)/1023;
  29. digit = (char)voltage;
  30. show_number(digit);
  31. Delay_ms(500);
  32. }

  33. }

 
Using a 0.5 second delay time making the display run very smooth without glitching. It could saves the power consumption since the ADC reading is not so frequently. For more information about using the ADC please read this post.

 

dsPIC30F3011 SPI Display 5VDC DVM using MikroC
Zero Volt ADC Reading

dsPIC30F3011 SPI Display 5VDC DVM using MikroC
3 Volt ADC Reading

dsPIC30F3011 SPI Display 5VDC DVM using MikroC
5 Volt ADC Reading

 I test example using my DIY dsPIC30F1010 Prototype Board. For more information about this PCB see this post.

 

No comments:

Post a Comment

Adskeep- Standard Ads

336x280

DIY Electronic Projects And Instruments

AdsKeeper - 2091654

Labels

23K256 (1) 24C16B (2) 25AA010A (2) 8051 (7) 93AA46B (1) ADC (39) Analog Comparator (1) Arduino (16) ARM (32) AT89C52 (7) ATMega32 (59) ATMega644P (27) AVR (88) AVR PCB (2) Bootloader (1) CCS PICC (31) Change Notify Interrupt (CNI) (2) DAC (2) DHT11 (5) Display (156) Distance Sensor (3) dot matrix (1) ds1307 (10) DS18B20 (6) ds3231 (1) ds3232 (2) dsPIC (12) dsPIC30F1010 (3) dsPIC30F2010 (12) EEPROM (5) Environment Sensor (6) ESP32 (1) esp8266 (1) Graphical LCD (3) HD44780 (10) I2C (38) ILI9341 (1) Input/Output (83) Interrupt (22) IoT PCB (1) Keil (5) Keypad (16) KS0108 (3) LCD (84) LM35 (4) Master/Slave (2) MAX7221 (1) MCP23017 (8) MCP23S17 (7) MCP4921 (1) MCP4922 (2) Meter (3) MikroC (2) MikroC ARM (1) MikroC dsPIC (7) Module PCB (2) Motor (15) MPLABX (73) Nokia 5110 LCD (4) OLED (2) One-Wire (7) Oscillator (8) PCB (13) PCD8544 (3) PCF8574 (10) PIC (116) PIC12F (3) PIC16 (105) 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) PICMicro PCB (4) Pin Change Interrupt (1) PWM (12) RTC (12) SBN0064G (1) Sensor (15) SH1106 (3) Shift Register (15) Shift Registers (19) SN74HC595N (9) Software TWI (2) SPI (44) sprinf (3) ST7735 (1) STM32 (29) STM32 Black Pill (1) STM32 Blue Pill (12) STM32 HAL (23) STM32CubeIDE (32) STM32F103C8T6 (9) STM32F103R6 (18) STM32F401CCU6 (1) SysTick (7) temperature sensor (15) TFT (1) TG12864A (1) Thermometer (22) Timer/Counter (32) TM1637 (2) twi (10) UART (11) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (96)