<< Chapter < Page Chapter >> Page >
The core file provides two macros, READSER and WRITSER, for communicating with a PC via the serial port. One can create graphical user interfaces in MATLAB to control the DSP in real time.

Using the serial port

The core file supports the serial port installed on the TI TMS320C54x DSP. The serial port on the EVM is connected with acable to COM2 on the PC. Before jumping to your code, the core file initializes the EVM's serial port to 38,400 bits persecond (bps) with no parity, eight data bits, and one stop bit (but it may be necessary to restart the DSP completely if theserial port does not work.) It then accepts characters received from the PC by the UART ( Universal Asynchronous Receiver/Transmitter ) and buffers them in memory until your code retrieves them. It also can accept ablock of bytes to transmit and send them to the UART in sequence.

Two macros are used to control the serial port: READSER and WRITSER . Both accept one parameter. READSER n reads up to n characters from the serial input buffer (the data coming from the PC) and places them in memory starting at *AR3 . ( AR3 is left pointing one past the last memory location written.) The actual number ofcharacters read is left in AR1 . If AR1 is zero, then no characters were available in the input buffer.

WRITSER n adds n characters starting at *AR3 to the serial output buffer; in other words, it queues them to besent to the PC. AR3 is left pointing one location after the last memory location read.

Note that READSER and WRITSER modify registers AR0 , AR1 , AR2 , AR3 , and BK , as well as the flag TC . Be sure you restore these registers after calling READSER and WRITSER if you need them later in your code.

Note also that the core file allows up to 126 characters to be stored in the input and output buffers. Neither the DSPhardware nor the core file protect against serial-buffer overflows, so you must be careful not to allow the input andoutput buffers to overflow. (The length of the buffers can be changed by editing ser_rxlen and ser_txlen values in core.asm .) The buffers are 127 characters long; however, the code cannotdistinguish between a completely-full and completely-empty buffer. Therefore, only 126 characters can be stored in thebuffers.

It is easy to check if the input or output buffers in memory are empty. The input buffer can be checked by comparing thevalues stored in the memory locations srx_head and srx_tail ; if both memory locations hold the same value, the input buffer is empty. Likewise, the outputbuffer can be checked by comparing the values stored in memory locations stx_head and stx_tail . The number of characters in the buffer can be computed bysubtracting the head pointer from the tail pointer; add the length of the buffer (normally 127) if the resulting distanceis negative.

The following example shows the minimal amount of code necessary to echo received data back through the serialport. It is available as ser_echo.asm .

1 .copy "core.asm" 2 3 .sect ".data" 4 hold .word 0 5 6 .sect ".text" 7 main 8 stm #hold,AR3 ; Read to hold location 9 10 READSER 1 ; Read one byte from serial port 11 12 cmpm AR1,#1 ; Did we get a character? 13 bc main,NTC ; if not, branch back to start 14 15 stm #hold,AR3 ; Write from hold location 16 WRITSER 1 ; ... one byte 17 18 b main

Questions & Answers

how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
what is inflammation
Shelly Reply
part of a tissue or an organ being wounded or bruised.
Wilfred
what term is used to name and classify microorganisms?
Micheal Reply
Binomial nomenclature
adeolu
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Ece 320 - spring 2003. OpenStax CNX. Jan 22, 2004 Download for free at http://cnx.org/content/col10096/1.2
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Ece 320 - spring 2003' conversation and receive update notifications?

Ask