没有合适的资源?快使用搜索试试~ 我知道了~
Siegesmund, Embedded C Programming 原版PDF
需积分: 9 12 下载量 37 浏览量
2018-08-12
08:52:23
上传
评论
收藏 27.35MB PDF 举报
温馨提示
试读
419页
Microcontrollers are computers on a chip. When they power up they start running a program from internal program memory, also called ROM for read only memory, or Flash. Microcomputers are found in appliances, toys, automobiles, and computer peripherals, such as a keyboard or mouse, and are finding their way in as support electronics for almost everything electronic from battery chargers to RADAR systems. The Microchip PIC® microcontrollers have become the most popular choice for new designs based on their high speed, of up to 70 million instructions per second as of this writing; low cost, some under $1; and large number of interfaces like USB, Ethernet, and analog signals.
资源推荐
资源详情
资源评论
Embedded C Programming
Techniques and Applications of C and
PIC
®
MCUS
Mark Siegesmund
AMSTERDAM • BOSTON • HEIDELBERG • LONDON • NEW YORK • OXFORD
PARIS • SAN DIEGO • SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO
Newnes is an imprint of Elsevier
Newnes
Newnes is an imprint of Elsevier
The Boulevard, Langford Lane, Kidlington, Oxford OX5 1GB, UK
225 Wyman Street, Waltham, MA 02451, USA
First edition 2014
Copyright © 2014 Elsevier Inc. All rights reserved
No part of this publication may be reproduced, stored in a retrieval system or transmitted
in any form or by any means electronic, mechanical, photocopying, recording or otherwise
without the prior written permission of the publisher
Permissions may be sought directly from Elsevier’s Science & Technology Rights Depart-
ment in Oxford, UK: phone (+44) (0) 1865 843830; fax (+44) (0) 1865 853333; email:
permissions@elsevier.com. Alternatively you can submit your request online by visiting
the Elsevier web site at http://elsevier.com/locate/permissions, and selecting Obtaining
permission to use Elsevier material
Notice
No responsibility is assumed by the publisher for any injury and/or damage to persons
or property as a matter of products liability, negligence or otherwise, or from any use or
operation of any methods, products, instructions or ideas contained in the material herein.
Because of rapid advances in the medical sciences, in particular, independent verification
of diagnoses and drug dosages should be made
British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library
Library of Congress Cataloging-in-Publication Data
A catalog record for this book is available from the Library of Congress
ISBN: 978-0-12-801314-4
For information on all Newnes publications
visit our web site at books.elsevier.com
Printed and bound in United States of America
14 15 16 17 18 10 9 8 7 6 5 4 3 2 1
Contents
Introduction �������������������������������������������������������������������������������������������������������xv
Chapter 1: C Overview and Program Structure �������������������������������������������������������1
C Source Code ..................................................................................................... 1
Comments ............................................................................................................ 1
Program Structure ................................................................................................ 2
C Preprocessor Directives .................................................................................... 2
Functions .............................................................................................................. 2
Declarations ......................................................................................................... 3
Statements and Expressions ................................................................................. 3
Time ..................................................................................................................... 4
Typing Accuracy .................................................................................................. 4
Text Formatting .................................................................................................... 5
Compatibility Notes ............................................................................................. 5
Summary .............................................................................................................. 5
Quiz ...................................................................................................................... 8
Chapter 2: Constants �����������������������������������������������������������������������������������������11
Bits, Bytes, Etc. .................................................................................................. 11
Bits ...................................................................................................................11
Nibbles .............................................................................................................11
Bytes ................................................................................................................11
Memory Sizes ..................................................................................................12
Syntax of C Constants ........................................................................................ 12
Binary ............................................................................................................... 12
Decimal ............................................................................................................14
Signed Integers ................................................................................................. 14
Hexadecimal ....................................................................................................15
Octal .................................................................................................................17
Floating Point ................................................................................................... 18
Fixed Point .......................................................................................................18
Characters ........................................................................................................18
String of Characters .........................................................................................19
True and False ..................................................................................................20
Const ................................................................................................................21
vi
Contents
Tri-Graph Sequences .......................................................................................... 21
Compatibility Notes ........................................................................................... 23
Design Documentation ....................................................................................... 23
Summary ............................................................................................................ 23
Quiz .................................................................................................................... 25
Chapter 3: Preprocessor Directives ����������������������������������������������������������������������27
Standard Preprocessor Directives ...................................................................... 27
#define id text ................................................................................................... 27
#include <filename> or #include “filename” ...................................................29
#ifdef #ifndef #else #endif #undef ...................................................................29
#if #else #elif #endif ........................................................................................30
#error ................................................................................................................ 30
#nolist #list ....................................................................................................... 31
Compatibility Notes ........................................................................................... 31
Nonstandard Pragmas ........................................................................................ 32
#warning ..........................................................................................................32
#use delay .........................................................................................................32
About Frequency .............................................................................................. 32
#use rs232 (options) .........................................................................................33
#fuses options ...................................................................................................33
#locate id=address ........................................................................................... 34
#byte id=x #word id=x ...................................................................................34
#bit id=x.y .......................................................................................................35
#reserve address ...............................................................................................35
Bootloaders ......................................................................................................35
#rom address={data} ......................................................................................35
#id data ............................................................................................................. 36
Other Pragmas .................................................................................................. 36
Summary ............................................................................................................ 37
Quiz .................................................................................................................... 39
Chapter 4: Data Variables and Types �������������������������������������������������������������������43
Data Types .......................................................................................................... 43
Characters ........................................................................................................43
Integers ............................................................................................................. 44
Compatibility Note...........................................................................................44
Integer Format .................................................................................................. 45
Enumerated Types ............................................................................................45
Fixed Point .......................................................................................................46
Floating Point ................................................................................................... 46
Interpretation Help ...........................................................................................46
Floating-Point Format ......................................................................................47
Void ..................................................................................................................47
typedef ..............................................................................................................48
剩余418页未读,继续阅读
资源评论
nn123456789
- 粉丝: 14
- 资源: 127
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功