当前位置:网站首页>CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
2022-07-06 09:48:00 【Ant soldier】
Preface
- Engaged in industry “ several tens of years ”, You can always meet these printing functions on different occasions , What's the difference , Today, the blogger will give the students a wisp
- Demonstrate hardware and software environment Win10 x64 ; CANoe 11 SP2 x64
- This chapter demonstrates the source code download , Click the jump
write
1️⃣ First create the project and file , For demonstration
2️⃣ write It is the simplest and most commonly used printing function , Post it here , It is to make you familiar with the print formats of different data types .
3️⃣ Testing process , Output Soure
The type is CAPL/.NET
on key 'a'
{
write ("pressed key %c",this);
}
writeEx
1️⃣ writeEx Just like write More complicated , You can specify the display position of printing , You can also specify the type of printing
- writeEx It will print on the last line of the window , That is to say No line wrapping
2️⃣ Testing process , Printed on Trace On , Remember trace Of CAPL To check
on key 'b'
{
writeEx (TraceWindow,Information,"pressed key %c",this);
}
3️⃣ Testing process , It can be seen that the output is System Page , And printing without line breaks
on key 'c'
{
writeEx (SystemWindow,Information,"pressed key %c",this);
writeEx (SystemWindow,Warning,"pressed key %c",this);
}
writeLineEX
1️⃣ and writeEx The difference between printing and wrapping , You can specify the display position of printing , You can also specify the type of printing
2️⃣ Testing process
on key 'd'
{
writeLineEx (SystemWindow,Information,"pressed key %c",this);
writeLineEx (SystemWindow,Warning,"pressed key %c",this);
}
writeToLog
1️⃣ writeToLog seeing the name of a thing one thinks of its function , That is to say Logging The document writes something ,
2️⃣ Since it's to logging File write data , Then create a logging Block , Set to CAPL Triggered mode , need logging
3️⃣ The test code is as follows :
On key 'f'
{
char timeBuffer[64];
getLocalTimeString(timeBuffer);
write("pressed key %d",this);
setLogFileName("logging", "test.asc");
startLogging("logging",100);
writeToLog("%s *************writeToLog*************",timeBuffer);
writeToLogEx("%s: *************writeToLogEx*************",timeBuffer);
stopLogging("logging",100);
}
4️⃣ Output results
- writeToLog and writeToLogEx The difference can also be seen ,writeToLog Just print more “// Time stamp ”
writeToLogEx
writeDbgLevel
1️⃣ This is very easy to use with functions , I suggest you learn to use , In larger projects , It is not recommended to use write
and writeLineEx
Wait for the output function to debug the code , Because we can't control these debug Output or not
- This function can decide whether to print it according to priority
- The first parameter is to specify priority , The lower the number is , Description higher priority ,debug The more likely information is to be output , Of course , It depends on
setWriteDbgLevel
Set priority - 0 The highest priority , If setWriteDbgLevel(0), So every time I call writeDbgLevel function , The first argument must be =0 , Can be output , Otherwise the output is suppressed
- 15 Has the lowest priority , If setWriteDbgLevel(15) So every time I call writeDbgLevel function , The first parameter is equal to whatever , Can output
- In actual development , We will pass weite too debug Our code , After debugging , We don't expect this debug The information is printed , Then we can go through setWriteDbgLevel Function to increase the output priority , Achieve the purpose of inhibiting output
- It is recommended to use ,
2️⃣ Test code and test results
On key 'g'
{
setWriteDbgLevel(7);
writeDbgLevel (4, "This is shown:");
// Output: This is shown
writeDbgLevel (9, "This is not shown");
// No output
}
End |
summary
- Have the most simple life , The furthest dream , Even if it's freezing tomorrow , Lu Yao's horse died !
- Wechat partners can pay attention Langge on-board diagnosis , A small circle in the industry , In the group
SkyDrive data
,Source code
,There are all kinds of gods
Free time communication technology , Talk about job opportunities .- If this blog is helpful to you , please “ give the thumbs-up ” “ Comment on ”“ Collection ” One key, three links Oh ! It's not easy to code words , Everyone's support is my driving force to stick to it .
边栏推荐
- Why is 51+ assembly in college SCM class? Why not come directly to STM32
- Activiti7工作流的使用
- 068.查找插入位置--二分查找
- CANoe仿真功能之自动化序列(Automation Sequences )
- Lua script of redis
- Meituan Er Mian: why does redis have sentinels?
- [deep learning] semantic segmentation: thesis reading (neurips 2021) maskformer: per pixel classification is not all you need
- MapReduce工作机制
- 五月刷题27——图
- O & M, let go of monitoring - let go of yourself
猜你喜欢
33岁可以学PLC吗
Minio distributed file storage cluster for full stack development
Teach you how to write the first MCU program hand in hand
[Yu Yue education] Wuhan University of science and technology securities investment reference
A wave of open source notebooks is coming
Redis分布式锁实现Redisson 15问
tn-c为何不可用2p断路器?
CANoe不能自动识别串口号?那就封装个DLL让它必须行
MapReduce instance (V): secondary sorting
Sqlmap installation tutorial and problem explanation under Windows Environment -- "sqlmap installation | CSDN creation punch in"
随机推荐
工作流—activiti7环境搭建
Use of activiti7 workflow
Une grande vague d'attaques à la source ouverte
解决小文件处过多
Mapreduce实例(八):Map端join
[deep learning] semantic segmentation: thesis reading (neurips 2021) maskformer: per pixel classification is not all you need
Vs All comments and uncomments
六月刷题02——字符串
O & M, let go of monitoring - let go of yourself
Research and implementation of hospital management inpatient system based on b/s (attached: source code paper SQL file)
51单片机进修的一些感悟
发生OOM了,你知道是什么原因吗,又该怎么解决呢?
【深度学习】语义分割:论文阅读:(CVPR 2022) MPViT(CNN+Transformer):用于密集预测的多路径视觉Transformer
How can I take a shortcut to learn C language in college
一大波開源小抄來襲
五月刷题27——图
Redis connection redis service command
【深度学习】语义分割:论文阅读:(2021-12)Mask2Former
嵌入式開發中的防禦性C語言編程
Release of the sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]