Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
THERM.C
Package: ertos.rar [view]
Upload User: sunrenlu
Upload Date: 2022-06-13
Package Size: 1419k
Code Size: 2k
Category:
OS Develop
Development Platform:
DOS
- /*
- * therm.exe - display thermometer results
- * - see README file
- */
- #include <rtos.h>
- #include <kconio.h>
- #include <ldriver.h>
- #include <emath.h>
- /*********************************************************************/
- /*********************************************************************/
- /***********************************************************************/
- /***********************************************************************/
- void therm_thread(DWORD port)
- {
- int i, j;
- int a;
- // float temp;
- int degreesF, degreesC;
- EM emF, emC;
- char buffer[ 64 ];
- for ( j = 0 ; j < 10 ; ++j ) {
- for ( i = 0 ; i < 2 ; ++i ) {
- PutA2DChannel( i );
- a = GetA2D();
- /* integer calculations */
- degreesC = (a-2732)/10;
- degreesF = ( (a*9)/5 - 4597 ) / 10;
- /* fixed point, higher accuracy calculations */
- emC = EM_DIV( EM_SUB( EM_ASSIGN(a,1), EM_ASSIGN( 2732 , 1 )), EM_ASSIGN( 10, 1));
- emF = EM_DIV( EM_SUB( EM_MUL(EM_ASSIGN(a,1),EM_ASSIGN(9,5)), EM_ASSIGN( 4597,1)),EM_ASSIGN(10,1));
- cprintf("sensor %u: %i F, %i C, ", i, degreesF, degreesC );
- cprintf(" %s F, ", emtostr( emF, buffer ));
- cprintf(" %s C ", emtostr( emC, buffer ));
- cprintf("rn");
- }
- rt_sleep( 1000 );
- }
- rt_halt("done");
- }
- /*********************************************************************/
- main ()
- {
- int msg;
- DWORD data;
- rt_init (200);
- rt_timerfreq( 100 );
- kpreemptive = 1;
- rt_newthread(therm_thread, 0 , 8192, 0, "therm session" );
- kreadmessage( &msg, &data );
- }