完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好…好的,所以我用PIC18F26K22组成了一个电路。并且在端口A的引脚上有一个电阻器的R 2R网络。所以,现在我是一个完全编程的PIC系列微处理器的新手。我处理这种情况的方法很奇怪。但对于那些真正的专业人士…请进一步阅读,所以我做了什么…我是否使用了一个叫做流代码的高级程序。来自英国公司。MatrixTsl…这个程序允许我(和其他)使用流程图类型的图标来构造程序,使用起来很简单,当然也有问题。毫无疑问…但是因为我是一个“躺着的科学家”,我需要做一些关于“一些东西”的研究。所以我必须继续这个项目,所以我用我能找到的任何东西来帮助我……正如我所说的,我在PIC处理器芯片组中根本不是一个傻瓜,但是我用这个FLOWCODE来做大量的项目,这些项目大部分都是成功的。对,所以回到项目。我用Excel来创建两组正弦波……我需要…然后。。因为流代码是无用的,在“高速”处理。我不得不改变对这个项目的想法,所以我有。Excel电子表格为我创建数据。然后我用一种特殊的方式将数据输出到处理器的PORTA和PORTC,所以我所做的是…在Excel中。我得到的数据输出在科隆…并使用我从电子表格获得的数字,乘以32767。然后对结果做一个int函数。然后把价值分成…低8…我在Excel电子表格中做所有这些,结果被记录在电子表格中的列中,现在在流代码程序中。我只是把许多输出端口串起来。然后把它们贴上PORTA标签。然后根据Excel电子表格的结果,我机械地从电子表格中输入值,进入流代码程序…因此,我建立了输出端口值。因此,对于正弦波的一部分来说…我可能有60套数据。然后进入流代码程序-并命名为…MP1.FCFX和该程序成为宏在程序的较大集合……然后我采取下一个波…比如说MP3。而且在化妆上也有PATA和PORTC。我努力编辑/插入数据到那个程序…它也变成了一个宏,所以最终我可以建立起一大堆波浪……在波形中。所有的特定波…成为流代码程序中的宏。说…我喜欢35套宏。将这批宏编译成一个十六进制文件…我现在把它编程成PIC18F26K22。当R 2R网络的输出是…播放到范围屏幕。你可以看到波形出现…有一个问题…这就是我希望你们大家能帮助我的地方……!!!问题是我可能在Excel电子表格中创建了一个波形……这是一个波形。比如说1000赫兹…但当我“玩出来”的范围…波形的频率不是1000赫兹。但有些完全不同的东西…说17.4千赫…所以我唯一能做的就是放慢PIC处理器…直到这样的时间,它的输出显示1000赫兹的波形…我怎么能这样做,请…????…或者我只是假设一些很愚蠢的事情????如果你们…可以帮助…我…我真的很感激…(也许机器代码程序员读这个…他们笑得前仰后合……也许如果我可以机器代码程序…我现在也在笑…我一点也不介意。!我已经试过整个程序了…在FLOWCODE…但是因为流代码的“用户界面”实际上是如此之大…输出没有足够快的循环…如果我能用C代码编程…也许它可以工作。我不确定…因为当我看C代码输出的流程代码…显然它很紧…所以我只希望…机器代码的语言将工作…当我编译流代码文件…我使用PRO软件包。PIC编译器的…从而优化输出代码…而且非常…我也检查过了。我希望有人能给我一个解决方案。我准备分享和工作的人。代码和流程代码程序。为了和…一起工作…我感谢你们大家阅读…很抱歉打扰了你们很多人…请原谅我。Cardac?南非…
以上来自于百度翻译 以下为原文 Hello folks... okay so I have made up a circuit using a PIC18F26K22.. and have a R 2R network of resistors on the pins of PORT A... and PORT C.. So now the thing is that I am a complete novice at programming the PIC series of microprocessors. My approach to this situation, is quite strange.. but for those real professionals... please read further. So what I have done.. is I have used a high level program called FLOWCODE.. from the UK company.. MatrixTsl.. and this program allows me (and others) to construct a program, with the use of flowchart type icons. It is quite plain to use, and surely, it has it's problems.. NO DOUBT.. but because I am a "lay scientist", I need to do some research on "some stuff"... so I have to get on with this project, so I use whatever I can find, to help me.. As I have said, I am not a fundy AT ALL in the PIC processor chipset, but I use this FLOWCODE for substantial projects, which have all mostly succeeded in working.!! Right - so back to the project. I use EXCEL to create the two sets of SINE waves... which I need.... and then.. because FLOWCODE is useless, at "high speed" processing.. I have had to change thoughts on this project. So I have. the EXCEL spreadsheet creating data for me.. and then I use the FLOWCODE in a peculiar way to output the data to the PORTA and PORTC of the processor. So what I do is ... in EXCEL.. I get the data output in colums.. and using the figure I get from the spreadsheet, and multiply it by 32767.. and then do an INT function on the result.. and then split the value up into... LOWER8... and UPPER8 bytes of data.. I do all of this in the EXCEL spreadsheet and the results are recorded into columns in the spreadsheet. Now in the FLOWCODE program.. I merely string together a lot of OUTPUT ports.. and label them PORTA followed by PORTC .. and then depending on the results from the EXCEL spreadsheet, I then mechanically enter the values from the spreadsheet, into the FLOWCODE programs... and so I build up the OUTPUT ports values. So for a +ve going part of a SINE wave... I may have like 60 sets of data.. which are then entered into the FLOWCODE program - and name it like ... mp1.fcfx and that program becomes a macro in the bigger set of the program... I then take the next wave.. like name it mp3.fcfx.. and it's also got PORTA and PORTC in it's makeup. and I diligently edit / insert data into that program... and it also becomes a macro. So eventually I can build up a whole host of waves... in the waveform.. all of the particular waves.. become macros in the FLOWCODE program. say... like 35 sets of macros. I then.. compile this lot of macros..into one HEX file... which I now program into the PIC18F26K22. and when the output of the R 2R network is then ... played out onto the scope screen.. you can see the waveforms appearing...!! THERE IS ONE PROBLEM... and this is where I want the rest of you folks to please help me...!!!! The problem is that I may have a waveform created in the EXCEL spreadsheet...that is a waveform.. of say - 1000 Hz... but when I "play it out" onto the scope... the frequency of the waveform is NOT 1000 Hz... but something like completely different... say 17.4 kHz.. So the only thing I can do is to slow down the PIC processor... until such time that it's output shows a 1000 Hz waveform.. How can I do this PLEASE..???... OR am I just supposing something really STUPID..??? If you folks.. can help.. me.. I would really appreciate it... (maybe the machine code programmers reading this... are laughing their heads off...?? maybe if I could machine code program.. I'd also be laughing now... I don't mind at all..!!) I have tried the whole program ... in FLOWCODE... but because the "user interface" of FLOWCODE is actually so great... the output does not 'cycle' fast enough... If I could program in C-code... maybe it might work.. I not sure... because when I look at the C-code output of the FLOWCODE... apparently it is pretty tight... and so I expect that only.. 'machine code' language will work.. When I compile the FLOWCODE files... I use the pro package.. of the PIC compilers.. so that the output code is optimized... and very much so... I have checked this as well.. I hope that someone may offer me a solution.. I am prepared to share and work with that someone.. the codes, and the FLOWCODE program.. for working with... I thank you all - for reading this... and sorry to upset a lot of you... my humble apologies please.?? Cardac.. south africa.. |
|
相关推荐
4个回答
|
|
对于一组表示频率的样本,必须指定输出的速率是多少。在ADC /DAC术语中,这是“采样率”。通常的做法是在每个输出操作之间插入一个延迟,而不是仅仅使PIC慢下来。设置一个硬件定时器,并在每次定时器达到特定值时输出一个新的数据点。我从未使用过FLOWCODE,所以不知道如何使用它。
以上来自于百度翻译 以下为原文 For a set of samples to represent a frequency, you MUST specify at what rate the samples are being output. In ADC/DAC terms, this is the "sample rate". The normal way to do this would be to insert a delay between each output operation, not just slow the PIC down. The accurate way to do it would be to set up a hardware timer, and output a new data point each time the timer reaches a specific value. I've never used FLOWCODE, so have no idea how you can do it using that. |
|
|
|
Flowcode生成C代码。如果您对C足够了解,可以编写自己的C函数来从无符号整数的C数组中检索样本,并将无符号整数拆分为两个字节,并更新端口,则会做得更好。你可以在Flowcode的程序中嵌入C的块。参见:练习-将代码插入流代码-流程代码帮助,然后很简单地在Excel电子表格中设置一个公式,生成一个文本列,它是一个语法正确的C数组,包含您可以复制和粘贴到程序中的数据。
以上来自于百度翻译 以下为原文 Flowcode generates C code. You'd do a lot better if you learn enough about C to be able to write your own C functions to retrieve the samples from a C array of unsigned integers, and to split an unsigned integer into two bytes and update the ports. You can embed chunks of C in a Flowcode 'program'. See: Exercise - Inserting Code Into Flowcode - Flowcode Help Its then fairly simple to set up a formula in your Excel spreadsheet that generates a column of text that's a syntactically correct C array containing your data you can just copy and paste into your program. |
|
|
|
波形生成已被讨论过。下面可能会有帮助:HTTP://www. McCHIP.COM/FUMUS/M1037 832.ASPX(波形发生器)HTTP://www. McCHIP.COM/FUMMS/M10034 40.ASPX(正弦波生成)一些更新的PIC有一个机载DAC,您可以使用而不是R 2R网络,否则您可能会使用PWM。正如所指出的,你需要时间采样率和每个周期的样本数量,以获得所需的频率。对于1 kHz和8位DAC,每个周期有256个采样,每个周期是1毫秒,所以采样需要在256千赫时钟。如果你使用一个4 MHz指令时钟的16 MHz时钟,在每个指令上输出8位代码,你将得到大约15.6千赫,这接近你的观测值。ED 17.4千赫。
以上来自于百度翻译 以下为原文 Waveform generation has been discussed previously. The following may help: http://www.microchip.com/forums/m1037832.aspx (Waveform generator) http://www.microchip.com/forums/m1003440.aspx (Sine wave generation) Some newer PICs have an on-board DAC that you might be able to use instead of the R-2R network, and otherwise you might use PWM. As noted, you need to time the sampling rate and the number of samples per cycle to get the desired frequency. For 1 kHz and an 8 bit DAC you will have 256 samples per cycle and each cycle is 1 mSec, so the samples need to be clocked at 256 kHz. If you are using a 16 MHz clock with a 4 MHz instruction clock, outputting 8 bit code on each instruction, you will get about 15.6 kHz, which is close to your observed 17.4 kHz. |
|
|
|
Microchip有一个关于使用流代码的文档。HTTP:/WW1.MICCHIP.COM/DeLoSs/En/DeVICEDC/OC1381B.PDFIT似乎产生标准的XC8代码,因此OP可以发布它用于分析和建议。
以上来自于百度翻译 以下为原文 Microchip has a document on using FlowCode. http://ww1.microchip.com/downloads/en/DeviceDoc/41381B.pdf It seems to produce standard XC8 code, so perhaps the OP can post that for analysis and suggestions. |
|
|
|
只有小组成员才能发言,加入小组>>
5189 浏览 9 评论
2009 浏览 8 评论
1933 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3181 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2232 浏览 5 评论
746浏览 1评论
632浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
517浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
644浏览 0评论
544浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-30 22:54 , Processed in 1.310045 second(s), Total 83, Slave 66 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号