佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

楼主: ^Hins86^

家电中央无线遥控器系统[完成了,感谢所有帮过我的人]

  [复制链接]
发表于 19-2-2010 04:31 PM | 显示全部楼层
怎么没update啦?
+_+"楼主, 做事有始有终嘛。。。。。。
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 22-2-2010 10:09 PM | 显示全部楼层
不好意思
我回来了
嘿嘿
续上次update 的
弄好了visual basic gui,transmitter main board,triac
接下来就剩下
microcontroller 的programming 而已
也就是c18 的programming
我的code 基本上是用miwi(microchip wireless) p2p 提供的code
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en536181
然后modify
我用的是miwi p2p c18 simple example 的code
miwi 的code 是 support picdemz,explorer 18 等等的
所以第一个步骤就是要define 我的board的parameter
关于define parameter 的detail 可以参考 #140 楼 fritlizt 版主的回复
第二个步骤就是写transmitter 的code
  1. while(1)
  2.     {
  3.               if (ConsoleIsGetReady())
  4.         {
  5.             BYTE i;
  6.         i=ConsoleGet();
  7.         MiApp_FlushTx();
  8.         MiApp_WriteData(i);
  9.         MiApp_BroadcastPacket(FALSE);
  10.        
  11.         }
  12.        
  13.         else if ( MiApp_MessageAvailable() )
  14.         MiApp_DiscardMessage();


  15.   
  16.     }
  17.        
复制代码

这个是我的transmiter 的code
是加在node 1 main program
  1. #ifdef ENABLE_DUMP
  2.         DumpConnection(i);
  3.     #endif

  4.     // Turn on LED 1 to indicate P2P connection established
  5.     LED_1 = 1;
复制代码

这个code 之后
这个code 之后没用到的code我都删除了

第三个步骤就是写receiver 的code
  1.         while(1)
  2. {
  3.   if( MiApp_MessageAvailable() )
  4.    {
  5.         if(rxMessage.Payload[0]=='0')
  6.         Out_1=0;

  7.         else if(rxMessage.Payload[0]=='1')
  8.         Out_1=1;

  9.         else if(rxMessage.Payload[0]=='2')
  10.         Out_2=0;

  11.         else if(rxMessage.Payload[0]=='3')
  12.         Out_2=1;

  13.    
  14.      MiApp_DiscardMessage();
复制代码


这个是我的receiver 的code
是加在node 2 的 main program
我的receiver side 有两个output
out_1 和 out_2

(rxMessage.Payload[0]=='0')
这个是我的receiver 接收到 0 的时候
要怎样respond

大致上这个project  就是这样
有什么不明白的请发问
谢谢
有什么要补充的请提醒我
回复

使用道具 举报

发表于 23-2-2010 11:55 PM | 显示全部楼层
不好意思
我回来了
嘿嘿
续上次update 的
弄好了visual basic gui,transmitter main board,triac
接下 ...
^Hins86^ 发表于 22-2-2010 10:09 PM




谢谢分享
可以看一下你的pic18f怎样接受那个pc的series com 的data 的code吗?
谢谢了
回复

使用道具 举报

 楼主| 发表于 24-2-2010 02:12 AM | 显示全部楼层
回复 183# akito

就transmitter 的code 啊
  i=ConsoleGet();
这个code 是get data from uart
也就是接收serial port send 来的data
回复

使用道具 举报

发表于 2-3-2010 06:33 PM | 显示全部楼层
哦谢谢回答,很乱下,因为看有些doc files是用WriteUART什么的。。。
问你一下,如果是#if defined(__18CXX) ,我要用pic18f4685的话,要改去
#if defined(pic18f4685)
还是
#if defined(__18f4685)?
还不清楚 =.="
回复

使用道具 举报

发表于 5-3-2010 04:34 PM | 显示全部楼层
回复 185# akito


   

不能。#define只是c programming preprocessor.
这个问题hin86有问过。你爬楼看看。不多,八面罢了。
回复

使用道具 举报

Follow Us
发表于 8-3-2010 05:16 PM | 显示全部楼层
第二个步骤就是写transmitter 的code
这个是写在什么文件里的
回复

使用道具 举报

发表于 8-3-2010 05:55 PM | 显示全部楼层
这个 config bit setting 是写在什么文件里

回复 140# fritlizt
回复

使用道具 举报


ADVERTISEMENT

发表于 23-3-2010 10:23 AM | 显示全部楼层
想问一下 MRF24J40MAT-I/RM  和 MRF24J40MA-I/RM   是不是一样的?
回复

使用道具 举报

发表于 23-3-2010 11:28 AM | 显示全部楼层
回复 189# Yapl


    一样的
packing不一样
回复

使用道具 举报

发表于 23-3-2010 07:59 PM | 显示全部楼层
回复  Yapl


    一样的
packing不一样
fritlizt 发表于 23-3-2010 11:28 AM



哦,好的谢谢
回复

使用道具 举报

 楼主| 发表于 25-3-2010 11:41 PM | 显示全部楼层
哦,好的谢谢
Yapl 发表于 23-3-2010 07:59 PM


如果没几错
我买的是
MRF24J40MA-I/RM
回复

使用道具 举报

发表于 27-4-2010 01:20 PM | 显示全部楼层
compile 了
但又error
build failed....
^Hins86^ 发表于 6-12-2009 01:16 PM

我现在也面对一样的error ;(
你怎样solve的? >.<
回复

使用道具 举报

发表于 27-4-2010 06:53 PM | 显示全部楼层
solve 了,把console.c 里的#define USART_USE_BRGH_HIGH 改成
#define USART_USE_BRGH_LOW 就可以了,但是现在我compile还是有Error,

Warning [2058] call of function without prototype
这个问题出在那个printf function,但是在Compiler.h里已经 #include<stdio.h> 了,为什么还会有这样的error =.=
回复

使用道具 举报

发表于 25-5-2010 12:53 PM | 显示全部楼层
本帖最后由 Yapl 于 25-5-2010 01:11 PM 编辑
solve 了,把console.c 里的#define USART_USE_BRGH_HIGH 改成
#define USART_USE_BRGH_LOW 就可以了,但 ...
Yapl 发表于 27-4-2010 06:53 PM

自己问自己答:
因为我先install "MiWi(TM) P2P for PIC18, PIC24, dsPIC, PIC32" ,然后我又 install "MiWi(TM) Protocol Stack for PIC18, PIC24, dsPIC, PIC32"在同一个folder,因为 "MiWi(TM) Protocol Stack for PIC18, PIC24, dsPIC, PIC32"里面的common files是久的,所以我用 "MiWi(TM) P2P for PIC18, PIC24, dsPIC, PIC32" compile的时候就有error.
现在那些hardware configure都已经弄好了,但问题来了,我的node1已经Start connection 了,但是node 2一直detect不到node 1,一直在active scanning... 是不是在breadboard上会有问题?不过我看到一些人用breadboard也可以的detect...还是同一个power supply有影响?现在我只有一个power supply.
Node 1


Node2:




  1. #if defined(__18F4685)
  2.                 #pragma config OSC = IRCIO67 // Internal oscillator block, port function on RA6 and RA7  
  3.                 #pragma config FCMEN = OFF // Fail-Safe Clock Monitor disabled
  4.                 #pragma config IESO = OFF // Oscillator Switchover mode disabled
  5.                 #pragma config BOREN = OFF //Brown-out Reset disabled in hardware and software
  6.                 #pragma config WDT = OFF // WDT disabled (control is placed on the SWDTEN bit)  
  7.                 #pragma config MCLRE = OFF // RE3 input pin enabled; MCLR disabled  
  8.                 #pragma config PBADEN = OFF // PORTB<4:0> pins are configured as digital I/O on Reset   
  9.                 #pragma config STVREN = ON, LVP = OFF, XINST = ON
  10.                 #pragma config DEBUG = ON // Background debugger enabled, RB6 and RB7 are dedicated to In-Circuit Debug   
  11.   


  12. #endif

复制代码
  1. void BoardInit(void)
  2. {
  3.     #if defined(ClientBoard)
  4.    
  5.         WDTCONbits.SWDTEN = 0; //disable WDT
  6.         OSCCON = 0x72;                                   //16mhz internal clock
  7.                 while (!(OSCCON & 0x40));        //wait till clock stable
  8.         // Switches S2 and S3 are on RB5 and RB4 respectively. We want interrupt-on-change
  9.         INTCON = 0x00;
  10.         
  11.         // There is no external pull-up resistors on S2 and S3. We will use internal pull-ups.
  12.         // The MRF24J40 is using INT0 for interrupts
  13.         // Enable PORTB internal pullups
  14.         INTCON2 = 0x00;
  15.         INTCON3 = 0x00;
  16.    
  17.         // Make PORTB as input - this is the RESET default
  18.         TRISB = 0xff;
  19.    
  20.         // Set PORTC control signal direction and initial states
  21.         // disable chip select
  22.         LATC = 0xfd;
  23.    
  24.         // Set the SPI module for use by Stack
  25.         TRISC = 0xD0;
  26.    
  27.         // Set the SPI module
  28.         #if defined(HARDWARE_SPI)
  29.             SSPSTAT = 0xC0;
  30.             SSPCON1 = 0x20;
  31.         #endif
  32.         
  33.         // D1 and D2 are on RA0 and RA1 respectively, and CS of TC77 is on RA2.
  34.         // Make PORTA as digital I/O.
  35.         // The TC77 temp sensor CS is on RA2.
  36.         ADCON1 = 0x0F;
  37.    
  38.         // Deselect TC77 (RA2)
  39.    //     LATA = 0x04;
  40.    
  41.         // Make RA0~RA2 as outputs. RA3~RA7 as input
  42.         TRISA = 0xF8;
  43.         
  44.         PHY_CS = 1;             //deselect the MRF24J40
  45.         PHY_CS_TRIS = 0;        //make chip select an output   
  46.         
  47.         RFIF = 0;               //clear the interrupt flag
  48.    
  49.         RCONbits.IPEN = 1;
  50.         
  51.         INTCON2bits.INTEDG0 = 0;
  52.                    LCDInit();
  53.    
  54.     #else
  55.         #error "Unknown demo board.  Please properly initialize the part for the board."
  56.     #endif
  57. }
复制代码

  1.     #if defined(ClientBoard)
  2.         #define CLOCK_FREQ 16000000
  3.         
  4.         // Transceiver Configuration
  5.         #define RFIF INTCONbits.INT0IF
  6.         #define RFIE INTCONbits.INT0IE
  7.         #define PHY_CS LATCbits.LATC0
  8.         #define PHY_CS_TRIS TRISCbits.TRISC0
  9.         #define PHY_RESETn LATCbits.LATC2
  10.         #define PHY_RESETn_TRIS TRISCbits.TRISC2
  11.         #define PHY_WAKE LATCbits.LATC1
  12.         #define PHY_WAKE_TRIS TRISCbits.TRISC1
  13.         
  14.         #define PUSH_BUTTON_1 PORTBbits.RB5
  15.         #define PUSH_BUTTON_2 PORTBbits.RB4
  16.         #define PUSH_BUTTON_3 PORTBbits.RB3
  17.         #define PUSH_BUTTON_4 PORTBbits.RB2
  18.         #define PUSH_BUTTON_5 PORTBbits.RB1
  19.         #define PUSH_BUTTON_6 PORTAbits.RA3
  20.         #define LED_1 LATAbits.LATA0
  21.         #define LED_2 LATAbits.LATA1
  22.         #define BELL LATAbits.LATA2
  23.         
  24.         #define BUTTON_1_TRIS TRISBbits.TRISB5
  25.         #define BUTTON_2_TRIS TRISBbits.TRISB4
  26.         #define BUTTON_3_TRIS TRISBbits.TRISB3
  27.         #define BUTTON_4_TRIS TRISBbits.TRISB2
  28.         #define BUTTON_5_TRIS TRISBbits.TRISB1
  29.         #define BUTTON_6_TRIS TRISAbits.TRISA3
  30.         #define LED_1_TRIS TRISAbits.TRISA0
  31.         #define LED_2_TRIS TRISAbits.TRISA1
  32.         #define BELL_TRIS TRISAbits.TRISA2
  33.         
  34.         #define RF_INT_PIN PORTBbits.RB0
  35.         #define RF_INT_TRIS TRISBbits.TRISB0
  36.         
  37.         #define SPI_SDI     PORTCbits.RC4               
  38.         #define SDI_TRIS    TRISCbits.TRISC4
  39.         #define SPI_SDO     LATCbits.LATC5               
  40.         #define SDO_TRIS    TRISCbits.TRISC5
  41.         #define SPI_SCK     LATCbits.LATC3               
  42.         #define SCK_TRIS    TRISCbits.TRISC3
  43.         
  44.         #define TMRL TMR0L
  45.     #endif
复制代码

我node1和node2的hardware configuration都一样,PAN ID也是0x1234
不过EUI_0 就不一样,一个是0x01另一个是0x02

评分

参与人数 1积分 +20 收起 理由
fritlizt + 20 热心回复

查看全部评分

回复

使用道具 举报

发表于 25-5-2010 11:21 PM | 显示全部楼层
本帖最后由 fritlizt 于 25-5-2010 11:24 PM 编辑

回复 195# Yapl


   
不错不错, 你做到什么程度了啊?
可以communicate了吗?
p2p还是miwi network?

你是一开始就打算用miwi了吗?还是看到论坛有讨论,可以一起讨论?
其实miwi很不错。。。protocol全都免费使用, 又有library,c18也是免费。虽然zigbee protocol比较强悍,不过一般上这类型的network node不会超过100个node. miwi有lebih 了。。。。
回复

使用道具 举报


ADVERTISEMENT

发表于 25-5-2010 11:31 PM | 显示全部楼层
回复 195# Yapl


   

你先不要用active scan,直接指定要用哪一个channel,比如说channel 16.
这样的话一个会host,另一个会connect去host.试试看。
你是什么学校的?很多人用miwi吗?
回复

使用道具 举报

发表于 10-6-2010 06:02 PM | 显示全部楼层
我想问一个问题。用AM transmitter and receiver 不是更便宜吗?
(虽然说AM signal vulnerable to noise ...)
回复

使用道具 举报

发表于 10-6-2010 08:19 PM | 显示全部楼层
回复 198# zkchong


如果是 1对1的communication,还好 。不过 如果是一对多呢?
如果 再引入network的概念呢?
这类型的implementation有好处就是可以很flexible.可以create wlan类似的low power bandwidth wireless network.
把network引入embedded system有很多好处。现在其中一个相当热门的implementation就是 wireless sensor network.你可以去 google下。
还有的是 wireless sensor network in health monitoring.这些都需要运用到low power的network system.
回复

使用道具 举报

发表于 12-6-2010 08:37 AM | 显示全部楼层
Hi fritlizt。谢谢你的回答。

在下对ZigBee不感冒的地方是因为ZigBee protocol stack不是免费的。 所以我在想是不是有一些人已经在发展open source 的 protocol stack 呢。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-5-2024 01:30 AM , Processed in 0.069339 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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