Design of electronic storage cabinet based onRTOS SmallDepartment of electronics and communication engineering,PSG college,Coimbatore IndiaAbstract:This paper introduces the design principle of the electronic storage controlsystem based on RTOS Small,and introduces the system used in this system to make thecontroller,which can manage the N storage cabinet at the same time.The door lock iscontrolled by the electromagnetic valve,when customers need to save the package,can goto the lockers before press the"open"button,the microcontroller receives a pulse signal,and the system I/O port to send corresponding signals to control the electromagnetic valvelock door will be an empty box is opened,the customer can save the package and the doorshut.When the customer needs to take the package,will as long as the bar code placed infront of the bar code reader,barcode reader bar code information collected by the outputvoltage signal corresponding to the microcontroller,the password system is relativelyconsistent,send out signals to the solenoid valve is open,the customer can remove thepackage.
Key words:Small RTOS;electronic storage cabinet;save package1、IntroductionRTOS RAM Small demand for small,very suitable for such a relatively smallresources of the system.RTOS has a multi tasking,strong real-time,and can be reduced tothe kernel,making the design of real-time applications,expansion and maintenance easier.
The introduction of the idea of RTOS,instead of the traditional software design method,sothat it is no longer a single thread structure,through the application is divided into severalindependent tasks,RTOS makes the design process of application system is simplified.Inthis paper,the software design of electronic storage cabinet based on single chipmicrocomputer is combined,the design idea of RTOS Small and the application ofmessage queue communication mechanism are briefly analyzed.
1.1 basic principles of RTOS51 SmallRTOS51 Small is a very small kernel,fully integrated in the C51 KEIL compiler,onlytake less memory space,you can run in the 51 single chip microcomputer system withoutexternal data memory.The kernel is responsible for initializing and open,other tasksscheduling system,according to the priority of tasks,a reasonable distribution of CPU indifferent time between tasks,the kernel can generally provide task scheduling and interruptservice function.A program and a task,the task of each separate,independentimplementation of the part called thread.All event driven and time driven are reflected inthe settings of the corresponding task identification and thread identification.When thehardware environment,on the basis of the identification,by arranging the system interruptand task scheduling algorithm adjust the response,by using the method of setting upenvironmental variables,which can interrupt exit after return to any more than one set ofentrance in one to perform,and effectively solves the key problem of flexible switching offoreground and background tasks thread.RTOS Small 51 user tasks with a running state,ready state,wait and suspend,interrupt service program.At any moment,the state of thetask is one of these four states.In order to save memory,create and delete mission OSdynamic,with the function OSSTART()to start a multi tasking environment,OS took allthe tasks set up,and set them as the ready state,the highest priority task to run.Only whenall the priority is higher than its task to wait.Ready to enter a state of operation.Thescheduler will be the top priority of the task ready list as the next task to be performed.
Task call os_wait function,pending the current task,waiting for one or severalintervals(K_IVL),time out(K_TMO),signal(K_SIG)events.If waiting for event hasoccurred,continue to implement the current task;if waiting for events did not occur,thecorresponding waiting sign,suspend the task to task switching program segment switch tothe next task.
Small RTOS51(init)by performing a function to register initialization,call thefunction OSSTart()to initialize each task stack and perform the first task,and the choiceof the first task for the reason that the task priority level.In the selection process tocomplete the task of scheduling.
1.2 communication between tasksCommunication between tasks using the message queue,after 3 steps:to create amessage queue OSQCreate(),to the message queue message OSQPost(),take messageOSQPend().Call the OSQPost()function to send the message,if you already have a taskwaiting for the message,immediately turn to wait for the news task,if the message queueis full,is unable to deliver the message,return an error.If the message queue is not full,butthere is no other task waiting for the message,then.It is worth noting that,when the queueis full,the function does not suspend the current task,so call the function of the task shouldbe judged to return the condition,if the message is full,it should be hung from the currenttask.When receiving a message,if the message queue is empty,the task of taking themessage will be suspended until a message is received in the message queue.
2.Application examples2.1Hardware platformFor example,the system block diagram is as follows.
The electronic storage cabinet can control the maximum number of goods storage boxis 32,divided into about 16 boxes,the picture only draw 16 road control.Control chipusing AT89C55 microcontroller,with real-time clock module,bar code reader,liquidcrystal display module,thermal printer composition,designed to three PCB board.
1 master control board,the user’s storage and access to the user interface,save thepackage password,display the user access to the password in the process of the passwordinput and the state of all 32.
The 2 door control panel is composed of three parts,the first part of the box is detected,。