New answers tagged

3

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 ...


0

Here 1234 variable used for timing application.Assume 1234 where 12 M and 34 Sec. Can some one suggest me how to do it. void main() { 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/


0

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 ...


0

"What part of it sets the pin (MOSI) high and low to transfer bit." This line: SPDR = data; sends the data out.


2

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 ...


5

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 ...


3

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: NVIC_EnableIRQ(TIM3_IRQn);


1

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. LDI R29,0x08 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 ...


1

No, LDI loads the immediate value of 8 to R29. Therefore stack pointer is set to 0x08FF.


0

Few really good static checker tools that you must consider: PC-Lint -> My personal favorite. LDRA 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 ...


Top 50 recent answers are included