- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I can't find examples of this in C or with the Built in modules. How would I make a task scheduler so that I can read my ADC switch Channels and read again.. and so on.
Thanks, Examples are usually the best
Solved! Go to Solution.
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Normally when one talks of a task scheduler you think of an RTOS -
http://www.cypress.com/?rID=2809 AN2046 - PSoC® 1 Simple RTOS (Task Scheduler)
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A task-scheduler in a PSoC1 is a rather tight program eating up a lot of resources (flash, sram). In the embedded world you usually have a main loop that is executed as long as power is applied. Within this loop you can read your ADC, switch to the next channel, output the data, read ADC......
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Normally when one talks of a task scheduler you think of an RTOS -
http://www.cypress.com/?rID=2809 AN2046 - PSoC® 1 Simple RTOS (Task Scheduler)
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
RTOS_Timer8.h doesn't seem to be available for my model. Would I be able to do the same for a Timer8? if not am I able to "import" it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thats just the naming of the Timer8. In its properties window
when you have selected it, you can change its name to anything.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That was exactly what I was looking for. However after setting everything up It seems that the program does not crash but my tasks are never called. Something to do with not satisfying the if statements? I've attached my project if anyone is up to help
Thanks Again
Edit: Could it have to do with not having parameters set up on my timer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have to clear up these warnings/errors for starters -
!W C:\Users\Dana\Desktop\xxRTOS\BICS\BICS\led_commands.c(37):[warning] missing return value
!W C:\Users\Dana\Desktop\xxRTOS\BICS\BICS\main.c(6): extra token ";" in preprocessor directive
And the timer properties window warnings -
Level 5 Warning - Configuration bics, User Module Timer8: Capture value has not been initialized.
Level 5 Warning - Configuration bics, User Module Timer8: TerminalCountOut value has not been initialized.
Level 5 Warning - Configuration bics, User Module Timer8: CompareOut value has not been initialized.
Level 5 Warning - Configuration bics, User Module Timer8: CompareType value has not been initialized.
Level 5 Warning - Configuration bics, User Module Timer8: InterruptType value has not been initialized.
Level 5 Warning - Configuration bics, User Module Timer8: ClockSync value has not been initialized.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Any suggestions on values? for the timer?
Edit: I will folow some suggested values on the document you gave me. Thanks For all The Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And you have to modify boot.tpl interrupt vector (in root project directory) -
http://www.cypress.com/?id=4&rID=36720 PSOC 1 boot.tpl
http://www.cypress.com/?rID=91487 AN90833 - PSoC® 1 Interrupts
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use the same values as the begining of main() uses to setup timer.
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Edit: Answering myself, I need to do more 😄
-------------------------------------------------------------------------
is That what I Did in Timer8_INT.asm or is it different.
_Timer8_ISR:
;@PSoC_UserCode_BODY@ (Do not change this line.)
;---------------------------------------------------
; Insert your custom assembly code below this banner
;---------------------------------------------------
; NOTE: interrupt service routines must preserve
; the values of the A and X CPU registers.
Push X ; save the A and X registers
push A
mov A,[__r0] ; save virtual registers
push A
mov A,[__r1]
push A
call _Process_Time_Slot_Counter ; C call Function
pop A ;restore virtual registers
mov [__r1],A
pop A
mov [__r0],A
pop A ; restore A and X registers
pop X
;---------------------------------------------------
; Insert your custom assembly code above this banner
;---------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I added an ljump and also put
#pragma interrupt_handler Process_Time_Slot_Counter
is Process_Time_Slot_Counter not my interrupt_handler?
I had also uncommented
PRESERVE_CPU_CONTEXT
lcall _Process_Time_Slot_Counter
RESTORE_CPU_CONTEXT
was _Process_Time_Slot_Counter not correct for the "lcall"?
I attached my project to be easier to see where I'm at
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The earlier links on setting up interrupt give you a simple
method of creating a C ISR routine, I highly recommend
that as opposed to doing it in ASM.
So you would have your own name for the ISR. Note in the
Imagecraft user manual in Designer documentation it shows also
how to declare a C interrupt.
Regards, Dana.