wguodong08 发表于 2013-8-9 14:54:36

cvavr自带的DS18b20例子,使用有问题。。求助

用的是mega128的片子,之前用自带的LCD头文件,成功调试LCD显示。。
现在想加入DS18B20测温。直接使用CVAVR的自带的实验例程。但是遇到问题,LCd根本乱码。。

CVAVR自带例程中,标注。

/* Multipoint thermometer with LCD display
   using the Maxim DS18B20
   1 Wire bus temperature sensors

   CodeVisionAVR C Compiler
   (C) 2000-2005 HP InfoTech S.R.L.
   www.hpinfotech.ro

   Chip: ATmega8515
   Memory Model: SMALL
   Data Stack Size: 128 bytes
   
   THE ATmega8515 CLOCK FREQUENCY MUST BE 3.6864 MHz

   The DS18B20 sensors are connected to
   bit 6 of PORTA of the ATmega8515 as follows:

      
    1 GND         -   9GND
    2 DQ          -   7PA6
    3 VDD         -10 +5V

   All the temperature sensors must be connected
   in parallel
   
   AN 4.7k PULLUP RESISTOR MUST BE CONNECTED
   BETWEEN DQ (PA6) AND +5V !
*/
#asm
    .equ __w1_port=0x1b
    .equ __w1_bit=6
#endasm

。。。。

例子用的芯片是ATmega8515。我现在换成mega128应修改哪些东西?
上边说的使用3.6864M晶振,我是用的是mega128中的4M晶振,时序能差多少,为啥不现实。

求助。。。
页: [1]
查看完整版本: cvavr自带的DS18b20例子,使用有问题。。求助