Error:
0 [main] sh 2312 sync_with_child: child 4744(0x14C) died before initialization with status code 0xC0000142
73796 [main] sh 2312 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
rm -rf main.o test.elf dep/* test.hex test.eep test.lss test.map
make: [clean] Error -1073741502 (ignored)
Build succeeded with 0 Warnings...
0 [main] sh 1484 sync_with_child: child 2300(0x14C) died before initialization with status code 0xC0000142
64185 [main] sh 1484 sync_with_child: *** child state waiting for longjmp
/usr/bin/sh: fork: Resource temporarily unavailable
avr-gcc -mmcu=atmega644pa -Wall -gdwarf-2 -std=gnu99 -DF_CPU=3686400UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT main.o -MF dep/main.o.d -c ../main.c
../main.c:57: fatal error: opening dependency file dep/main.o.d: No such file or directory
compilation terminated.
make: *** [main.o] Error 1
Build failed with 1 errors and 0 warnings...
=> Solution:
Download this file and put it to folder install Win AVR (GCC) : utils\bin directory (WinAVR)
Link:http://www.madwizard.org/download/electronics/msys-1.0-vista64.zip
Thursday, June 20, 2019
Thursday, June 13, 2019
Digital dimmer using Microcontroller atmega8
This project is used to control the brightness of the lamp or can be used to control the speed of the fan.
The system consists of 3 block they are.
The system consists of 3 block they are.
- Zero crossing detector
- Microcontroller (Atmega8)
- Load Driver (BT136)As the name implies the zero crossing detector generates pulses for every zero crossing of the input AC signal. This pulses are fed to the microcontroller interrupt pin through the opto coupler. The opto coupler is used for the isolation of the high voltage AC to the low voltage DC supply at the microcontroller side.
- The microcontroller was interrupted for every zero crossing which switch on the TRIACas per the user need. The user can increase or decrease the output voltage with help of 2 push buttons.The TRIAC BT136 is used to drive the load. It can withstand a maximum load of 5A. You can also use an opto coupler at the TRIACfiring side.
PWM DC motor control using MOSFET H-Bridge with AVR ATmega8
Hi friends,
here is a very simple project of controlling a small DC-motor (taken from an old personal cassette player) with ATmega8. The ATmega8 is having three PWM channels, out of which two are used here. PWM waveforms are fed to MOSFET (RFD3055) H-bridge.
Here, direction is controlled using a two-position toggle switch and speed of the motor is controlled by two push-buttons, one for increasing the speed and other for reducing.
The schematic is geiven here (click on the image to enlarge):
When switch SW1 is closed, OC1A channel is active which will feed the PWM signal to Q1 & Q4 MOSFETs. The OC1B pin will remain low keeping the Q3 & Q2 in OFF condition. When SW1 is toggled to open position, OC1A pin will become low, making Q1 & Q4 OFF and OC1B will feed the PWM signal to Q3 & Q2, resulting in the change in the direction of current flow hrough motor. Hence, motor rotation direction will change.
The speed is controlled by Push-buttons S2 & S3. Pressing S2 will increase the speed in fixed steps. Similarly, pressing S3 will reduce the speed in fixed steps.
The closer look to the motor and the circuit:
here is a very simple project of controlling a small DC-motor (taken from an old personal cassette player) with ATmega8. The ATmega8 is having three PWM channels, out of which two are used here. PWM waveforms are fed to MOSFET (RFD3055) H-bridge.
Here, direction is controlled using a two-position toggle switch and speed of the motor is controlled by two push-buttons, one for increasing the speed and other for reducing.
The schematic is geiven here (click on the image to enlarge):
When switch SW1 is closed, OC1A channel is active which will feed the PWM signal to Q1 & Q4 MOSFETs. The OC1B pin will remain low keeping the Q3 & Q2 in OFF condition. When SW1 is toggled to open position, OC1A pin will become low, making Q1 & Q4 OFF and OC1B will feed the PWM signal to Q3 & Q2, resulting in the change in the direction of current flow hrough motor. Hence, motor rotation direction will change.
The speed is controlled by Push-buttons S2 & S3. Pressing S2 will increase the speed in fixed steps. Similarly, pressing S3 will reduce the speed in fixed steps.
The closer look to the motor and the circuit:
Interfacing RTC Ds1307 & serial EEPROM using i2c bus, with ATmega128
Hi friends,
here is my experiment with i2c bus for interfacing serial EEPROM (24C256) and RTC (DS1307) using AVR microcontroller ATmega128. The circuit is also provided with an RS232 port for connecting with PC to send commands for reading/writing EEPROM or setting date/time in RTC (Click on images to enlarge them).
Communication with PC is done through Hyper Terminal. A screen shot of the message sent to PC by microcontroller immediately after power ON is shown in the figure at the left, where the user is asked to enter choice from the menu options related to EEPROM and RTC. User can store data in EEPROM, or set RTC date and time by entering them using PC keyboard.
Hyper Terminal is used with 19200 Baud, No parity, No hardware flow control settings.
When the circuit is powered on, a welcome message is displayed on the Hyper Terminal window and a menu with 9 options (0-8) is displayed (refer to the figure). The options are explained here:
0: Erase EEPROM (fills eeprom with 0xff bytes)
1: Write EEPROM (starts writing eeprom starting with 0x0000 address)
2: Read EEPROM (reads eeprom starting with 0x0000 address)
3: Write eeprom page (writes one page of eeprom at specified page number)
4: Read eeprom page (Reads one page of eeprom at specified page number)
5: Display RTC Date (Displays current date from RTC)
6: Display RTC time (Displays current time from RTC)
7: Update RTC Date (Setting new date in RTC)
8: Update RTC time (Setting new time in RTC)
The option is selected from PC keyboard. While writing to eeprom or RTC the data is entered using PC keyboard as specified by the program.
The software routines include DS1307 library, 24C256 library & I2C library along with the main function.
The code is written in C using winAVR (inside AVRStudio). The complete project folder can be downloaded here in zip format (updated on 25-April-2009, earlier it was in ICCAVR format):
Here is running simulation on Proteus ISIS (click on image to enlarge it):
Source code: https://www.dharmanitech.com/search/label/Thermometer
NOKIA 3310 LCD interfacing with AVR - ATmega8
Hi friends,
The connector of LCD is 'touch' type. So, I made a small connecor PCB with tracks touching to the pins of LCD. The pcb was pasted at backside of LCD using cello tapes as shown in the back-view image
.
Here is a testing with Proteus ISIS Simulation:
using graphic LCD in a project gives itreally a good look and flexibility of displaying different characters and shapes. But, the graphic LCDs are quite costly.
The NOKIA 3310 LCD provides a really low-cost solution to add a small graphic display into your project and also good for learning purpose. The LCD is SPI bus compatible, saving many pins for other uses. It operates at 3.3v.
Here is a small circuit for interfacing the 3310 LCD with AVR microcontroller ATmega8. The schematic includes LCD connection with SPI port of ATmega8 with other connections required by LCD. The 3.3v is generated using adjustable voltage regulator LM317 (I was not having any 3.3v regulator at the moment). An LED is also connected with microcontroller just for making sure that the controller is working, particularly when you don't see anything on the display!
Here is the schematic and the pin details of the LCD:
Here is a small circuit for interfacing the 3310 LCD with AVR microcontroller ATmega8. The schematic includes LCD connection with SPI port of ATmega8 with other connections required by LCD. The 3.3v is generated using adjustable voltage regulator LM317 (I was not having any 3.3v regulator at the moment). An LED is also connected with microcontroller just for making sure that the controller is working, particularly when you don't see anything on the display!
Here is the schematic and the pin details of the LCD:
The connector of LCD is 'touch' type. So, I made a small connecor PCB with tracks touching to the pins of LCD. The pcb was pasted at backside of LCD using cello tapes as shown in the back-view image
.
Here is a testing with Proteus ISIS Simulation:
The program routines are written in C with ICCAVR compiler. I've created a library for this display. The low-cost, easy availability has made me relly like this display.
I'm going to use it for
doing other stuffs, too!
I'm going to use it for
Tuesday, June 11, 2019
LED dot matrix and STM32
We all come across some kind of DOT matrix displays in our daily lives. Those sign boards scrolling from one end to another end and some of them even displaying some cool animation. Today in this tutorial I will show you guys How to interface LED dot matrix with STM32.
We are only going to cover the initial part today i.e. display some characters on a single 8×8 dot matrix and scrolling and other features will be covered in upcoming tutorial.
HOW TO
First let’s see how the display even works. I have a 8×8 led display attached to a MAX7219 driver IC. The MAX7219 is compact, serial input/output common-cathode display drivers that interface microprocessors to 7- segment numeric LED displays of up to 8 digits, bar-graph displays, or 64 individual LEDs.
The following are the features of MAX7219
The following are the features of MAX7219
- Individual LED Segment Control
- Decode/No-Decode Digit Selection
- 150”A Low-Power Shutdown (Data Retained)
- Digital and Analog Brightness Control
- Display Blanked on Power-Up
- Drive Common-Cathode LED Display
- Slew-Rate Limited Segment Drivers for Lower EMI (MAX7221)
- SPI, QSPI, MICROWIRE Serial Interface (MAX7221)
- 24-Pin DIP and SO Packages
On going through the datasheet of MAX7219, you will notice the timing diagram and the data format diagram on page-6.
According to the above diagram, In order to write data to max7219, we need to do the following:-
1.) Pull the CS pin LOW
2.) Pull the clock pin LOW
3.) Write one bit to the data pin
4.) Pull the clock pin HIGH
5.) Repeat steps 2,3 and 4 until both address and data bytes are written
6.) Pull the CS pin HIGH
1.) Pull the CS pin LOW
2.) Pull the clock pin LOW
3.) Write one bit to the data pin
4.) Pull the clock pin HIGH
5.) Repeat steps 2,3 and 4 until both address and data bytes are written
6.) Pull the CS pin HIGH
Also note that the data should be written in MSB first format. Let’s write the code for STM32 now. My CubeMx configuration is shown below..
Some Insight into the CODE
The following is the function for writing a byte to max7219
1
2
3
4
5
6
7
8
9
10
|
void write_byte(uint8_t byte)
{
for(int i=0;i<8;i++)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, 0); // Pull the CLK LOW
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_7, byte&0x80);// Write one BIT data MSB first
byte = byte<<1; // shift the data to the left
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, 1); // Pull the CLK HIGH
}
}
|
As you can see above that for writing each bit of data, we have to Pull the CLK pin low and than pull it high after writing the bit. Also byte&0x80 means that we are writing the MSB bit and than shifting the bit to left by using byte<<1.
Next we need to write another function for writing address and data to the MAX.
Next we need to write another function for writing address and data to the MAX.
1
2
3
4
5
6
7
|
void write_max (uint8_t address, uint8_t data)
{
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, 0); // Pull the CS pin LOW
write_byte(address); // write address
write_byte(data); // write data
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_6, 1); // pull the CS HIGH
}
|
Here we have to pull the CS pin LOW and after writing both address and data, pull it back to HIGH.
1
2
3
4
5
6
7
8
|
void max_init(void)
{
write_max(0x09, 0x00); // no decoding
write_max(0x0a, 0x03); // brightness intensity
write_max(0x0b, 0x07); // scan limit = 8 LEDs
write_max(0x0c, 0x01); // power down =0,normal mode = 1
write_max(0x0f, 0x00); // no test display
}
|
TO initialise the DOT matrix display we have to do the following:-
–> Set noo decode in the Decode mode register (0x09)
–> Set intensity value in the intensity register (0x0A)
–> Scan limit = 8 LEDs in 0x0b
–> value of 1 in the 0x0c denotes the normal power on mode
–> Set 0 in the Display test register (0x0f)
–> Set noo decode in the Decode mode register (0x09)
–> Set intensity value in the intensity register (0x0A)
–> Scan limit = 8 LEDs in 0x0b
–> value of 1 in the 0x0c denotes the normal power on mode
–> Set 0 in the Display test register (0x0f)
Now in order to display any character (For eg ‘A’), Think of the Registers from 0x01 to 0x08 as the addresses of the 8 ROWs and we need to turn the respective LEDs ON in each ROW. The following are the values for each row to display ‘A’
{0x18,0x24,0x42,0x42,0x7E,0x42,0x42,0x42}
You can check the code for more details.
{0x18,0x24,0x42,0x42,0x7E,0x42,0x42,0x42}
You can check the code for more details.
Subscribe to:
Posts (Atom)