Micro Controller based queue system

Thread Starter

@vajra

Joined May 2, 2018
154
It may be a stupid question but I think It is always good to do the experiment with led's. I want to make a queue c program with 8051. I have 8051 microcontroller, LED's and switch button's

Is it possible to implement a queue program with LED's and Switches only? What would be the object ?

FIFO Queue
 

AlbertHall

Joined Jun 4, 2014
11,498
Say you had eight buttons for data in and eight LEDs for data out.
Then you have a 'join' queue, and 'leave' queue buttons.
You set up data in (easier with switches than buttons but could be less than 8 - 3 perhaps?).
Press the join button and the data is added to the queue.
Repeat adding data for some number of times.
Then you can press the leave button which will extract the first data you entered and display it on the LEDs.
etc.
etc.
 

Thread Starter

@vajra

Joined May 2, 2018
154
Say you had eight buttons for data in and eight LEDs for data out.
Then you have a 'join' queue, and 'leave' queue buttons.
You set up data in (easier with switches than buttons but could be less than 8 - 3 perhaps?).
Press the join button and the data is added to the queue.
Repeat adding data for some number of times.
Then you can press the leave button which will extract the first data you entered and display it on the LEDs.
etc.
etc.
My planning to use eight LED's and one switch button. Eight LED's are in the queue

Turn off LED's in queue (First turn on LED should be First off )

When switch presses first time Turn on LED1 for 50ms
When switch presses second time Turn on LED2 for 50ms
When switch presses third time Turn on LED3 for 50ms .. up to eitht LED

Is it the correct example or need to modify?
 

mvas

Joined Jun 19, 2017
538
A FIFO Queue usually has ...
a) A Head Pointer = reads the oldest ( "first" ) entry out of the queue
b) A Tail Pointer = adds a new value to the end of the queue
There can be a variable number of values in a FIFO - from zero, to max size
A Fixed Length FIFO can get FULL - which affects how / if you add a new entry
A FIFO queue may be EMPTY - which affects the Read_FIFO() function
The Head & Tail Pointers, may need to wrap around the ends of a "circular" buffer.
Adding new entries into the FIFO Queue and reading from the FIFO Queue are typically asynchronous events

What you have described with your 8 LED's is more like an 8 Bit Shift Register.
Using a very "minimalist" definition of a FIFO Queue, someone may consider an 8 Bit Shift Register a very basic FIFO QUEUE.
 

Thread Starter

@vajra

Joined May 2, 2018
154
A FIFO Queue usually has ...
a) A Head Pointer = reads the oldest ( "first" ) entry out of the queue
b) A Tail Pointer = adds a new value to the end of the queue
There can be a variable number of values in a FIFO - from zero, to max size
A Fixed Length FIFO can get FULL - which affects how / if you add a new entry
A FIFO queue may be EMPTY - which affects the Read_FIFO() function
The Head & Tail Pointers, may need to wrap around the ends of a "circular" buffer.
Adding new entries into the FIFO Queue and reading from the FIFO Queue are typically asynchronous events

What you have described with your 8 LED's is more like an 8 Bit Shift Register.
Using a very "minimalist" definition of a FIFO Queue, someone may consider an 8 Bit Shift Register a very basic FIFO QUEUE.
Thank you
Whenever I feel difficulty in project I just start to test the program with LED
Here I am trying to implement queue but I don't undestand how to start with LED
 

Yaakov

Joined Jan 27, 2019
3,464
Thank you
Whenever I feel difficulty in project I just start to test the program with LED
Here I am trying to implement queue but I don't undestand how to start with LED
Is this only an experiment or are you trying to figure out how to do something practical.

If this is part of some practical device, what is it? How will it actually be used, not with the LEDs?

Your experiment may have nothing to do with your goal if there is anything more to this.

What are you planning to do with your circuit?
 

Thread Starter

@vajra

Joined May 2, 2018
154
Are you trying to move 8 bits in at a time (i.e., one byte) or moving just one bit in as another "exits" the opposite end?
Is this only an experiment or are you trying to figure out how to do something practical.

Your experiment may have nothing to do with your goal if there is anything more to this.
No, it's just experiment I was trying to make a small queue program that should work with basic component's just like LED's and Push Button

I googled a lot but I didn't find related to these experiments
 

jpanhalt

Joined Jan 18, 2008
11,088
No, it's just experiment I was trying to make a small queue program that should work with basic component's just like LED's and Push Button
I googled a lot but I didn't find related to these experiments
I understand it is an experiment and have no objection that. In fact, when there are aspects of my programs that cannot be simulated using MPLab SIM or ICD3, I use led's to troubleshoot.

You still have not answered whether your queue is bit by bit or byte by byte. At least in Assembly, those two situations can be handled quite differently.
 
Top