Design of a network multimedia system based on DS80C400 microcontroller to realize audio and video examples
“With the rapid development of Electronic information technology, the demand for exciting multimedia applications, including PA-Public address system, network doors, MP3 players, and security cameras, is also increasing. Today, with the development of network technology, a low-cost network microprocessor DS80C400 can be used to establish and implement. Its characteristic is that it can transmit 4 original black and white images per second without any hardware image compression, and the resolution can reach 240180 pixels.
With the rapid development of electronic information technology, the demand for exciting multimedia applications, including PA-Public address system, network doors, MP3 players, and security cameras, is also increasing. Today, with the development of network technology, a low-cost network microprocessor DS80C400 can be used to establish and implement. Its characteristic is that it can transmit 4 original black and white images per second without any hardware image compression, and the resolution can reach 240180 pixels.
1. The establishment of a network-type wired PA system
1 Commonly used or traditional PA system
The PA system is a system used for paging/internal communication and sound amplification. Its sound reinforcement system has two main components, namely amplifier and speaker. The composition of the PA system is shown in Figure 1. Private branch exchange is to connect the outside telephone line to a certain building residence or office extension, and the PBX system functions include call forwarding, speed dialing, internal/external paging and call detailed records.
When the PA system is working, the operator broadcasts a number of messages to the personnel in the form of broadcasting and paging, such as “Attention all staff, the fire alarm system is being tested”, or “The supervisor, please report to the chemical library”, etc. For this type of system, people often use traditional independent wiring and infrastructure technology to achieve.
2 Network type wired public address (PA) system
Now, if this system is moved to the network, the situation will be different, not only can save the independent audio wiring, but also can make the system more intelligent. This is because the paging system has been connected to the access control system of each building or a certain network server, so that the operator can easily know the location of a certain person. Moreover, this computerized network-based PA system can also automatically repeat a message, so that the operator can be freed to handle more calls. What’s more novel is that the system can also be connected to the company-wide mail system to realize mail-to-speech conversion services; or publish messages through a website that can input paging requests without manual intervention.
So how can we build such a network-based PA system? First of all, at least one server with a microphone running WEB interface and email gateway is required. We call this server the Master control server. Next, some speaker modules are needed, such as DS80C400 networked microcontrollers, with digital-to-analog converters (DACs) capable of driving speakers. These loudspeaker units require low prices and require on-site installation to be quite easy. Figure 2 is a block diagram of the internal structure of the DS80C400 network microcontroller.
Figure 3 shows a schematic diagram of the network-based audio and video PA system architecture. The network-based PA system realizes network operation between two buildings M and L. It includes 7 speaker units and a main control server; the network connection between the buildings uses a router instead of a bridge . In this network PA system, DS80C400 network microcontroller drives the speaker unit. Since this type of network PA system does not require high bandwidth and processing power, the processing power and storage resources of the PC system possessed by the DS80C400 controller are sufficient to support the operation of the system. For this reason, the uncompressed mono audio bandwidth requirement for 8-bit sampling rate of 22.05kHz is sufficient to provide excellent voice quality within 180Kbps. And there is no need to pay for hardware decompression, thus greatly improving the performance-price ratio of the network-type PA system.
Figure 4 is a schematic diagram of the relative bandwidth requirements of this type of network audio system. The section line shown in Figure 4 is the bandwidth area of the network audio PA system, indicating that the audio bandwidth of this type of network audio system only needs 0.25 Mbps, even in the early network (half-duplex) 10 Mbps (see the coordinate in Figure 4) (Vertical axis), compared to the 5Mbps effective bandwidth capacity of this network-type PA system, the audio bandwidth (0.25Mbps) also uses only 5% of the capacity. Compared with most of today’s Ethernet bandwidths that require 100Mbps, it is extremely low and greatly saves capacity.
3 The configuration of the speaker unit hardware
In addition to DS80C400, the speaker unit also needs some memory (512KB of SRAM is enough), network PHY (open system interconnect), DAC, amplifier and speakers. For this reason, installation and code distribution are simplified through the following technologies:
● Through the network boot method “NetBoot” equipped with the DS80C400 network microcontroller, and NetBoot uses DHCP (Dynamic Master Configuration Protocol) and TFTP (Trivial File Transfer Protocol) network protocols to obtain IP addresses and loader data, reducing installation and Configuration cost
● Power over Ethernet (see Figure 3, as shown by the upper and lower two horizontal circular thick lines, Ethernet cable) simplifies wiring and reduces material costs.
After power-on, the DS80C400 ROM obtains an IP address through DHCP (Dynamic Master Configuration Protocol), and then queries the network to obtain the latest version of the application. After the application is executed, the system is ready to receive audio data. Find an unused network port on site and connect the cable to complete the installation of the new speaker module unit.
4 Speaker unit software
In order to simplify the installation of the hardware, the software needs to do some extra work. Due to the presence of a router between the two buildings (see the middle of Figure 3), broadcast and call messages cannot directly reach another building from one building. Therefore, simple message broadcasting cannot be used. A new loudspeaker must send a multicast message until the master control server confirms the position and parameters of the loudspeaker. A new speaker system cannot know the location of the master server in advance, so it also needs to send a multicast message to request the master to confirm itself. If security issues are considered, digital signatures can be used to exchange information to exclude systems that pretend to be servers. Once the traditional unicast message configuration is adopted, the speaker unit joins a multicast group and waits for audio packets, which are multicast by the main controller. Multicast is used because the operating environment of DS80C400 and TINI (Tiny interNet interface) supports multicast, which is different from unicast packets sent from one source to one destination, allowing multiple destination hosts to receive the same data, thus Eliminates repeated transmissions and saves bandwidth. In the network, multicast packets use a special type of target IP address, which is called a multicast group network.
The sample program of the PA system is written in C language. It should be noted that, with the exception of join( ), these writing steps should be quite familiar to programmers who write code for TCP/IP networks.
5 About Power over Ethernet
To connect the device to the network, additional cables need to be added to the network. Fortunately, the power supply can be integrated into the spare wires of the Ethernet cable. There are many ways to solve this problem. The most common is the IEEE 802.3af standard, which stipulates that the 48V power supply is connected to pins 7, 8 (+) and 4, 5 (GND) of an 8-pin Ethernet connector. 48V power supply is commonly used in telephone systems, so this power supply is usually already in the wiring closet. In order to be applied to networked microcontrollers, the power supply must be stepped down to an appropriate level.
6 Text to speech
Using a microphone to record live voices or play recordings stored on a network server is one of the ways to apply network-based PA systems. The other is to use text broadcast messages received from e-mail, WEB pages or cell phone short message services.
It is very easy to add speech synthesis to the system. The conversion can be performed directly on the main control server. The text-to-speech conversion engine is used to generate audio waveforms from the input text, and then this waveform can be sent to the speaker like other audio signals. The speaker module does not need to be used. Any changes. The text-to-speech conversion engine has been widely used and has become an integral part of some operating systems (such as Mac OSX).
7 Entertainment grade audio
If audio samples are transmitted in an uncompressed manner, CD audio will encounter problems. Unprocessed stereo at 44.1kHz 16-bit sampling requires a network bandwidth of 1.44Mbps (almost 30% of a 10Mbps network), which has exceeded the bandwidth that many networks can provide.
Compression algorithms such as MP3 can reduce the data rate, thereby greatly improving the network load capacity, making the system practical. With the hardware decompression chip, DS80C400 can easily complete the task. In fact, the 36MHz clock rate is enough to play 192KB MP3 continuously.
Connect the video signal to the DS80C400, such as a security camera, and use an inexpensive camera to take a snapshot every second and send it to the Internet for Display and storage. Server-side post-processing can complete motion monitoring and alert security personnel. A better camera option is modern cellular phones-they are not only small, cheap, and available everywhere, most of which use a serial protocol for communication, but different manufacturers It is also possible to use different communication protocols.
Experiments show that without any hardware-assisted image compression, DS80C400 can transmit 4 frames of original black and white images (240,180) per second, and there is a certain margin for processing voice-level audio. For those familiar with Unix network programming, closesocket() is close(). The close() function of the DS80C400 version is used by the file system. Like the Windows system, the socket handle and file handle on the DS80C400 are not interchangeable, and a separate socket function must be used.
The clock frequency provided by the camera system to the DS80C400 is 73.7MHz, which is close to the limit of 75MHz. The 73.7MHz frequency is obtained by 4 times the frequency of the 18.432MHz crystal in the baseband mode and the PLL (Phase locked loop) integrated on the DS80C400. This design reduces the cost of the entire system, while also allowing work close to the upper limit of the maximum frequency of the microcontroller. In addition, 18.432MHz4 is still a good baud rate generator for asynchronous serial communication.
9 network gate
It is easy to combine security cameras with two-way audio, buttons and buzzers. Such a system allows us to build a network gate (see Figure 5). Applications are endless, especially when combined with access control and secure login. For DS80C400, buttons and buzzers are just external devices that can be directly connected to ordinary I/O.
In Keil C, through sfr and shit, it is easy to define I/O ports:
／* Define port 1 *／
Sfr pl = 0x90;
／* Define P1.7 (port 1 is bit addressable) *／
sbit pl_7 = pl^7; /* Toggle Pl. 7 *／
p_7 =! pl-7;
Using ibutton and the 1-Wire master controller interface built into the DS80C400, it is easy to add a security authentication function to the network door (to a certain extent, the programming of this interface is more complicated, so Dallas semiconductor provides library files for simplicity Task).
Note: A system such as a network gate may need to complete a variety of processing (or tasks). The DS80C400 ROM includes a task scheduler. The following example illustrates how to use it in C language. Also, in industrial applications, the return code should be checked.
unsigned Char pri, task;
／* Get the current task *／
task = task_getcurrent( );
／* The current task’S priority *／
pri = task_getpriority(0);
／* Decrease the priority *／
task_Setpriority (0, pri-1); / * Sleep * /
task_Sleep(0, 0, 500);
The sample program also contains some useful functions, such as task_fork( ), which creates a new task by copying the current task. Task_kill () cancels a task, and task_suspend () suspends a task.
Various methods can be used to develop DS80C400 application software. If you want to quickly evaluate the program, you can consider using the Java language and TINI runtime environment. For those applications that require consideration of each instruction cycle, it is best to use the most optimized assembly language.
In this article, we have adopted the C language. Keil C compiler supports DS80C400 continuous 24-bit addressing mode, allowing up to 16MB of code/data storage space. In order to use this mode, an extended version of the compiler and linker (CX51, LX51) is required. These tools are included in the professional developer tools (PK51).
Dallas Semiconductor provides C library files that interface to the DS80C400 internal network stack. You can find the library file, as well as a detailed operation guide for using the Keil development environment to create a DS80C400 project. These library files greatly simplify network programming. For example, creating two TCP connections has been simplified to the well-known sequential calls of socket() and connect().
The Links: SKD30-08A1 LP150X1-C2QT