<< Chapter < Page Chapter >> Page >
Explains how to send and receive data with the DSP through the serial port. Example code is shown in both assembly and C (for the DSP) as well as MATLAB for interfacing on the PC. Some example code for creating a MATLAB GUI is also shown.

Introduction

The serial port on the back of the DSP box can be used to transmit data between the DSP and the PC during real-time operation. Eight bits ofdata can be transmitted at one time (signed or unsigned). This can then be used as feedback from the DSP for a variety of applications. The serial port isconnected to a data buffer which holds values coming from the DSP until they are read. This allows for sending larger amounts of data (more than 1-byte) at a time from the DSP to the PC.The same is true in the opposite direction.

    Our serial port specifications

  • Port: com2
  • DataRate: 38400
  • Parity: None
  • StopBits : 1 Stop Bit
  • DataBits : 8 Data Bits
  • Handshaking : none
These parameters can be used when accessing the serial port through third-party utilities such as HyperTerminal (included with windows).

Using the dsp to access the serial port

The serial port data buffer can be written to with either C or assembly code. These functionalities are supplied through the core file, so it must be includedwith any of this code.

Using assembly to send/receive

Accessing the serial port in assembly comes in the form of macros (READSER and WRITSER). These macros allow for multiple bytes of data to be written to the serial portbuffer at a time.

  • READSER : READSER accepts one parameter, an integer number(n). The macro will read n bytes into memory and place them starting at the address *AR3 . The macro modifies AR3 and it is left pointing to one byte past the last memory location written. The actual number of data bytes read isput into AR1 . If AR1 is zero, there were no available data byte sin the buffer. The calling format is: READSER n
  • WRITSER : Similar to the previous macro, WRITSER takes a single integer parameter n. This macro will add n bytes starting at *AR3 to the serial port buffer. *AR3 is left pointing one location after the last memory read. This data is queued in the buffer and will remain there until the PC retrieves the data. The calling format is: WRITSER n
READSER and WRITSER modify registers AR0, AR1, AR2, AR3, and BK as well as the flag TC.

The core file allows up to 126 characters to be stored in the input and output buffers. No checks to protect against buffer overflows are made, so do not allow the input and outputbuffers to overflow. (The length of the buffers can be changed by changing ser_rxlen and ser_txlen values in the core.asm file.) The buffers are 127 characters long; however, the code cannot distinguish between a completely-full and completely-empty buffer.Therefore, only 126 characters can be stored in the buffers.

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

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, Digital signal processing laboratory (ece 420). OpenStax CNX. Sep 27, 2006 Download for free at http://cnx.org/content/col10236/1.14
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Digital signal processing laboratory (ece 420)' conversation and receive update notifications?

Ask