- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Everyone,
I am having trouble with a Counter, my program has an EEPROM memory from which it reads the values and updates the counter,
I cant get the values to update.
the counter triggers an interrupt with a compare value
void update(){
Counter_Stop();
Counter_WritePeriod(revcount);
Counter_WriteCompare(revcount);
Counter_WriteCounter(0);
Counter_SaveConfig();
Timer_WritePeriod(Period);
Timer_WriteCounter(Period);
Counter_Start();
clr();screen();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you aware that revcount and period are 16 bit ints while your counter is only 8 bits wide.
in function update() is no reasonable code, commented due to despair ? 😉
I cannot find a place where you read data from eepromArray
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When still in trouble, do not hesitate to upload your latest project archive. Someone will have a look into it.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are still writing the number 300 +50 into an 8-bit wide component. Max is 255.
Do not wait with CyDelay() within an interrupt handler, the system might stall.
I cannot see what is not running, all values are as I expect them.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
please change the udb to 16bit, I am trying to update the counter period and compare values through firmware, when i run it the values are the ones set up in the hardware block
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At least put into your Init() function a Counter_Init(), so that the first Counter_Start() does not overwrite your settings.
I do not make changes in your program, there will be differences between our code too quickly.
Bob