Pumpkin, Inc.

Pumpkin User Forums

Handling Multiple Outcomes

If you're interested in purchasing Salvo but have some questions you want answered first, post them here.

Handling Multiple Outcomes

Postby schmitta » Wed Jul 16, 2008 7:26 am

Hi -- I am starting to think of tasks I need. I have a simple packet program (half duplex, RS485, Master/Slave). I think I can do 1)the control task; 2)the fill the ringbuffer task; 3)the send the ringbuffer task and 4)the receive task. My problem is that there will be two outcomes for the control task. 1) the receive task timed out and/or bad packet; 2)the packet was received successfully. How would this be handled? Multiple binary semiphores for handshaking or some other mechanism? Thank you. Alvin...

------------------
APSTRON
P. O. Box 10336
Blacksburg VA 24062-0336

APSTRON
P. O. Box 10336
Blacksburg VA 24062-0336
schmitta
 
Posts: 7
Joined: Tue Jul 15, 2008 11:00 pm
Location: Blacksburg VA USA

Re: Handling Multiple Outcomes

Postby aek » Wed Jul 16, 2008 7:46 am

You don't really need tasks on the send side -- just fill the ring buffer via a function, and use an ISR enabled by said function to empty the ring buffer out the Tx side.

On the Rx side you do want an ISR to fill the (Rx) ring buffer and a task to empty it.

You can wait in the receive task with a timeout -- if the timeout occurs OR if the packet that is passed up to the receive task is bad, then you have one case. If the packet is good, you have another. You could send a message to the control task to indicate either, or perhaps use event flags (eFlags).

If you don't care about low power, you could even have the control task periodically poll the status of the receive task.

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm

Re: Handling Multiple Outcomes

Postby schmitta » Wed Jul 16, 2008 9:20 am

quote:
Originally posted by aek:
You don't really need tasks on the send side -- just fill the ring buffer via a function, and use an ISR enabled by said function to empty the ring buffer out the Tx side.
***
I need to know when the data has been sent as I need to do a timeout if there is a wrong or no reply. I guess the send function could accumulate and send the check sum (in ring buffer). It will take eons of time to send the buffer at 9600 baud. but I think I see your point. I really can't do anything until the packet is transmitted and then the reply is received. The master is in full control.
***
On the Rx side you do want an ISR to fill the (Rx) ring buffer and a task to empty it.
***
I guess I will still have to do a state machine as each byte has meaning: 0x01 start; 0x0A and 0x0D end the packet (in order to use a terminal program to show what is going on over the net) and then there is the check sum . But all this could be done by a function on the data in the ring buffer. I am sort of thinking as I write so this will probably look disconnected.
***
You can wait in the receive task with a timeout -- if the timeout occurs OR if the packet that is passed up to the receive task is bad, then you have one case. If the packet is good, you have another. You could send a message to the control task to indicate either, or perhaps use event flags (eFlags).
***
I think what I am probably looking for is event flags although I will have to read up about them.
***
If you don't care about low power, you could even have the control task periodically poll the status of the receive task.
***
would not firing a semiphore to continue the control task be better? It will be locked up until it gets some indication on the receive packet.
***

I am not sure how this will look as I have not used your quote and B system yet. I don't know where to look to find these definitions (of quote and B)

APSTRON
P. O. Box 10336
Blacksburg VA 24062-0336
schmitta
 
Posts: 7
Joined: Tue Jul 15, 2008 11:00 pm
Location: Blacksburg VA USA

Re: Handling Multiple Outcomes

Postby tbims23822 » Wed Jul 08, 2009 11:31 am

www.drop-shopping.com is a premium website for cheap air jordans shoes and other more really nike air jordan shoes.We have varity of cheap air jordan shoes available for wholesale.Cheap China wholesale shoes including cheap Nike shoes and cheap jordan shoes,nike sneakers,nike sneakers discount,air jordan sneakers,air force sneakers.We supply nike sneakers,jordan sneakers,air jordan sneakers,air force sneakers wholesale.You can buy very cheap jordans shoes including cheap women shoes,cheap nike shoes,cheap running shoes from us.
tbims23822
 


Return to Pre-Sales Inquiries

Who is online

Users browsing this forum: No registered users and 1 guest

cron