Posts

Showing posts from February, 2026

Blog 2 - RTOS Using the PIC Microcontroller

Image
1.0 Introduction  In this next installment of the binbot blog, the process of RTOS will be examined. RTOS stands for: Real Time Operating System A real time operating system is a system in which multiple "tasks" (which will be represented by functions) are called and ran by a central piece of code, which is the operating system. In a real-time operating system, the operating system quickly cycles between tasks, breaking from one task to run the next.   Programs to be run in this experiment: Tasks Termination Enable/Disable Messages Yield Semaphores Await Statistics Basic Kernel   2.0 Programs 2.1 Tasks Tasks is the first and simplest piece of code to be run by the PIC. In this program the PIC simply cycles between different tasks of varying different rates.   Figure 1: Output of "Tasks" in the terminal window     Figure 1 shows the output of the program displayed in a terminal window. It can be seen from this that tasks 3 and 4 are the highest priority task...

BLOG 2 RTOS

Image
  RTOS RTOS What is an RTOS? An RTOS is a piece pof code, or a system that controls other pieces of code.  PIC Microcontroller Demonstration   Demo_1  Run Demo 01 code below was ran:  #task(rate=1000ms,max=100ms) // the function can be called anything that a standard function can be called void The_first_rtos_task ( ) {    printf("1\n\r"); } #task(rate=200ms,max=100ms) void The_second_rtos_task ( ) {    printf("\t2!\n\r"); }  Record   The code's output is recoded in Putty.  # Demo_01 inital Review The code runs each of the tasks at interval, at a given speed rate of 100ms, 200ms, 100ms. Revise For an iteration I added more tasks, and reduced the speed for each tasks operation.  #task(rate=100ms,max=100ms) void The_third_rtos_task ( ) {    printf("\t\t3\n\r"); } #task(rate=100ms,max=100ms) void The_fourth_rtos_task ( ) {    printf("\t\t4\n\n\r"); } Demo_01 modified Demo_2  Run Demo 2 is all about te...

Blog 2

Image
 RTOS Demo codes     In this blog, I will explore the purpose and functionality of the provided RTOS demo codes. What is RTOS RTOS represents for 'Real Time Operating System'. Operating System (OS) is a piece of codes that runs other piece of codes. RTOS works as the diagram showing above, it looks as multiple while loops working at the same time. But the truth is the time interval between each task is too small, so as the former task is finished the later one is also ready to be finished.  RTOS Demo 1: The RTOS is configured with a 100 ms minor cycle, and four tasks are defined with rates of 1000 ms, 500 ms, and 100 ms (for the remaining two tasks). Once rtos_run() is called in main(), the scheduler repeatedly executes each task according to its specified period. Each task outputs a short identifier (1, 2!, 3, and 4) through the serial port, allowing the user to observe how tasks with different timing intervals are interleaved and managed by the RTOS. The number of ...