搜索
bottom↓
回复: 16

能不能在pic上开发,然后转程序到飞凌,义隆单片机上

[复制链接]

出0入0汤圆

发表于 2011-4-8 15:57:39 | 显示全部楼层 |阅读模式
考虑到便宜的单片机都不太适合初次开发,毕竟只可以烧录一次,所以想在别的芯片上开发,然后转到这些芯片上。

看了很多论坛上讨论的8Pin的芯片,为了节省成本,确实是不错的选择。

如果可以,是不是要特定的pic芯片,像pic12c509等等。

网上也看到一些商家,可以免费帮着做,还是不错的。大家都来看看,分享下经验。

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

 楼主| 发表于 2011-4-9 22:03:03 | 显示全部楼层
自己顶一下。。

出0入0汤圆

发表于 2011-4-10 04:02:28 | 显示全部楼层
the answer is yes and no.

if you design your code well, it is definitely doable. I code for high reliability and routinely write my code on Dev-C++ (windows) or Keil C51 for a variety of targets, mostly ARM chips. My code would utilize customized "api" that operate the hardware. during the development time, the "api" would be just dummy calls. once the code is reasonably debugged, I would port the entire code to my target,  link in the correct "api", and recompile. more often than not, the code runs out of the box.

this approach assumes that 1) you code for portability and reusability; and 2) you have a well developed proprietary library (the "api").

出0入0汤圆

发表于 2011-4-10 04:06:13 | 显示全部楼层
here is an example.

the following code was written for pic24. it runs four timers and each at different intervals and calls user-defined routines to perform some tasks.

========code================

#include <p24fxxxx.h>                                        //we use pic24f
#include "gpio.h"
//#include "delay.h"                                                //we use delay routines
#include "rtc2.h"                                                //we use tmr2
#include "rtc3.h"                                                //we use tmr3
#include "rtc4.h"                                                //we use tmr4
#include "rtc5.h"                                                //we use tmr5

//config fues settings
_CONFIG1(JTAGEN_OFF & GCP_OFF & FWDTEN_OFF);         //JTAG OFF, CODE PROTECTION OFF, WATCH DOG TIMER OFF
_CONFIG2(IESO_OFF & FNOSC_PRI & FCKSM_CSDCMD & POSCMOD_XT);         //TWO-STAGE START OFF, PRIMARY OSCILLATOR (HS/XT/EC), CLOCK FAILURE SWITCH DISABLED, PRIMARY OSCILLATOR IS XT

//hardware configuration
#define LED_PORT                        LATB
#define LED_PORT_IN                        PORTB
#define LED_DDR                                TRISB
#define LED2                                (1<<0)        //led0 on pb0
#define LED3                                (1<<1)        //led0 on pb1
#define LED4                                (1<<2)        //led0 on pb2
#define LED5                                (1<<3)        //led0 on pb3
#define LED2_DLY                        RTC_100ms                //dly for led2
#define LED3_DLY                        LED2_DLY << 1        //dly for led3
#define LED4_DLY                        LED3_DLY << 1        //dly for led4
#define LED5_DLY                        LED4_DLY << 1        //dly for led5
//end hardware configuration

void my_tmr2_isr(void) {
        IO_FLP(LED_PORT, LED2);                        //flip led0
}

void my_tmr3_isr(void) {
        IO_FLP(LED_PORT, LED3);                        //flip led0
}

void my_tmr4_isr(void) {
        IO_FLP(LED_PORT, LED4);                        //flip led0
}

void my_tmr5_isr(void) {
        IO_FLP(LED_PORT, LED5);                        //flip led0
}

void mcu_init(void) {
        IO_CLR(LED_PORT, LED2 | LED3 | LED4 | LED5);                        //clear led0
        IO_OUT(LED_DDR, LED2 | LED3 | LED4 | LED5);                        //led0 as output
       
        //CLKDIV = 0x2000;                                //not supported by proteus
        //DOZE2=0, DOZE1=1, DOZE0=0;        //clkdivider = 0b010 -> 1:4
}
       
int main(void)
{         

        mcu_init();                                                //reset the mcu

        rtc2_init(TMR_PS_1x, LED2_DLY);        //initialize rtc2's period to led2_dly
        rtc2_act(my_tmr2_isr);                        //implement my_tmr2_isr for tmr2 isr

        rtc3_init(TMR_PS_1x, LED3_DLY);        //initialize rtc3's period to led3_dly
        rtc3_act(my_tmr3_isr);                        //implement my_tmr3_isr for tmr3 isr

        rtc4_init(TMR_PS_1x, LED4_DLY);        //initialize rtc4's period to led4_dly
        rtc4_act(my_tmr4_isr);                        //implement my_tmr4_isr for tmr4 isr

        rtc5_init(TMR_PS_1x, LED5_DLY);        //initialize rtc5's period to led5_dly
        rtc5_act(my_tmr5_isr);                        //implement my_tmr5_isr for tmr5 isr

        ei();                                                        //enable global isr
        while(1) {
                //delay_ms(LED_DLY);                //waste some time
        }           
}
===============end==========

the "api" are the macros used to manipulate the port (IO_CLR, IO_SET, IO_FLP, IO_OUT, and IO_IN), and the timer routines are rtcx_init() and rtcx_act().

I would have similar routines doing the same thing on my target chip. and once I move to my code to that target environment, all I need to do is to link in the right api, recompile and I am ready to go.

出0入0汤圆

 楼主| 发表于 2011-4-11 08:44:25 | 显示全部楼层
虽然楼上理解错我的意思了,但是我觉得他的思想是比较好的,有利于代码移植。

出0入0汤圆

发表于 2011-4-13 15:10:40 | 显示全部楼层
请问一下,哪款单片机AD转换的可重复性好呀,即转换的结果比较稳定,没有大的波动

出0入0汤圆

发表于 2011-5-17 16:44:00 | 显示全部楼层
完全可以。

出0入0汤圆

发表于 2011-7-6 10:46:35 | 显示全部楼层
我们有远翔转换软件,可以免费提供,qq:1419889250。

出0入0汤圆

 楼主| 发表于 2011-7-26 15:05:40 | 显示全部楼层
现在已经在PIC12F508上开发,实验中

出0入0汤圆

 楼主| 发表于 2011-9-7 20:01:29 | 显示全部楼层
在飞凌上实验成功,功耗做到130uA,但是想把它再做小来就得用睡眠了,但是看门狗唤醒时间又不准,正在打算用其他芯片测试。

出0入0汤圆

 楼主| 发表于 2011-10-25 14:57:15 | 显示全部楼层
FM8PS53 有14PIN芯片,网上说这个可以通过PIC12F509但是引脚不兼容,不知道怎么搞

出0入0汤圆

 楼主| 发表于 2011-10-26 14:14:43 | 显示全部楼层
回复【11楼】chen20061084
-----------------------------------------------------------------------

查到资料上说PIC12F509的引脚兼容该芯片的4-11引脚,那只是兼容一部分而已。看样子要开发14Pin的只能使用FM的编译器了。

出0入0汤圆

发表于 2011-11-15 13:46:26 | 显示全部楼层
mark

出0入0汤圆

发表于 2012-7-30 15:58:19 | 显示全部楼层
先用PIC开发再转码到其它芯片是个好方法。我是直接用FM8PE53写的,借了代理商的仿真器。现在的情况是仿真器上跑的很利落,烧写到 FM8PE53上后运行很不理想。疑惑中。

出0入0汤圆

发表于 2012-7-31 10:44:57 | 显示全部楼层
eejia 发表于 2011-4-13 15:10
请问一下,哪款单片机AD转换的可重复性好呀,即转换的结果比较稳定,没有大的波动 ...

SN8P2711A不错,也便宜

出0入0汤圆

发表于 2014-9-11 14:43:37 | 显示全部楼层
这是坑人呢。
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-30 16:19

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表