1) variable declaration. I have declare variable unsigned int Top_Display=0; if assign Top_Display=0123 display shows 0083 if assign Top_Display=123 display shows 0123 Some of the variable it take properly and some are not. if i assign value Top_Display=0129 it gives error digit is out of range.
In C and many other programming languages, leading zero ...
Here 1234 variable used for timing application.Assume 1234 where 12 M
and 34 Sec. Can some one suggest me how to do it.
unsigned int min,sec,Top_Display=1234;
min = Top_Display/100;
sec = Top_Display%100;
// Assumptions: it willalways be a 4 digit number/valid number/
You have defined variables Hour, Min, Sec and Msec, but you aren't using them. Instead you just increment Bottom_Value on each timer tick, then convert it to decimal digits for display. The problem with this technique is that Bottom_Value only counts the number of milliseconds, so when you convert it to decimal you get illegal time values when the seconds or ...
If I'm not mistaken, your code is a regular Linux application, i.e. it runs in user space. Therefore, each call to read or write requires a context switch from user to kernel space. Most likely the process will also be paused while it waits for the answer from the I2C bus and needs to be rescheduled once the answer is ready. That has its cost.
Given your ...
Most likely the malloc and free are not thread safe so you can't allocate in interrupt and free in main loop. In general, there should be no dynamic memory allocation in interrupts. At least you should disable receive interrupts when popping a byte from the linked list. And in general rarely there should be need for linked lists using dynamic allocation in ...
I do not know much about coding.. but I cannot see the place where you are enabling the interrupts..
The interrupt for timer TIM3 can be enabled by adding the following line to the timer setup function:
This has nothing to do with PORTC register.
LDI means "Load Immediate", which says take a literal value and load it directly into a register.
Takes the literal value 0x08 and loads it into R29.
The function is basically initialising the stack pointer to point to the end of the RAM which can be seen from the below diagram to be 0x08FF. That ...
Few really good static checker tools that you must consider:
PC-Lint -> My personal favorite.
Both of these are highly customisable, where rules can be suppressed or enabled, and also can be integrated with TI CCS.
Using a static code checker conforming to rules like MISRA or CERT etc, can save a lot of potential bugs in the long run. Consider using ...