<< 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

what does preconceived mean
sammie Reply
physiological Psychology
Nwosu Reply
How can I develope my cognitive domain
Amanyire Reply
why is communication effective
Dakolo Reply
Communication is effective because it allows individuals to share ideas, thoughts, and information with others.
effective communication can lead to improved outcomes in various settings, including personal relationships, business environments, and educational settings. By communicating effectively, individuals can negotiate effectively, solve problems collaboratively, and work towards common goals.
it starts up serve and return practice/assessments.it helps find voice talking therapy also assessments through relaxed conversation.
miss
Every time someone flushes a toilet in the apartment building, the person begins to jumb back automatically after hearing the flush, before the water temperature changes. Identify the types of learning, if it is classical conditioning identify the NS, UCS, CS and CR. If it is operant conditioning, identify the type of consequence positive reinforcement, negative reinforcement or punishment
Wekolamo Reply
please i need answer
Wekolamo
because it helps many people around the world to understand how to interact with other people and understand them well, for example at work (job).
Manix Reply
Agreed 👍 There are many parts of our brains and behaviors, we really need to get to know. Blessings for everyone and happy Sunday!
ARC
A child is a member of community not society elucidate ?
JESSY Reply
Isn't practices worldwide, be it psychology, be it science. isn't much just a false belief of control over something the mind cannot truly comprehend?
Simon Reply
compare and contrast skinner's perspective on personality development on freud
namakula Reply
Skinner skipped the whole unconscious phenomenon and rather emphasized on classical conditioning
war
explain how nature and nurture affect the development and later the productivity of an individual.
Amesalu Reply
nature is an hereditary factor while nurture is an environmental factor which constitute an individual personality. so if an individual's parent has a deviant behavior and was also brought up in an deviant environment, observation of the behavior and the inborn trait we make the individual deviant.
Samuel
I am taking this course because I am hoping that I could somehow learn more about my chosen field of interest and due to the fact that being a PsyD really ignites my passion as an individual the more I hope to learn about developing and literally explore the complexity of my critical thinking skills
Zyryn Reply
good👍
Jonathan
and having a good philosophy of the world is like a sandwich and a peanut butter 👍
Jonathan
generally amnesi how long yrs memory loss
Kelu Reply
interpersonal relationships
Abdulfatai Reply
What would be the best educational aid(s) for gifted kids/savants?
Heidi Reply
treat them normal, if they want help then give them. that will make everyone happy
Saurabh
What are the treatment for autism?
Magret Reply
hello. autism is a umbrella term. autistic kids have different disorder overlapping. for example. a kid may show symptoms of ADHD and also learning disabilities. before treatment please make sure the kid doesn't have physical disabilities like hearing..vision..speech problem. sometimes these
Jharna
continue.. sometimes due to these physical problems..the diagnosis may be misdiagnosed. treatment for autism. well it depends on the severity. since autistic kids have problems in communicating and adopting to the environment.. it's best to expose the child in situations where the child
Jharna
child interact with other kids under doc supervision. play therapy. speech therapy. Engaging in different activities that activate most parts of the brain.. like drawing..painting. matching color board game. string and beads game. the more you interact with the child the more effective
Jharna
results you'll get.. please consult a therapist to know what suits best on your child. and last as a parent. I know sometimes it's overwhelming to guide a special kid. but trust the process and be strong and patient as a parent.
Jharna
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