Strange behaviour of ACMP2 on DZ60

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Strange behaviour of ACMP2 on DZ60

1,060 次查看
Francois
Contributor I

Hello,

 

I want to use ACMP2 on a 48 pin DZ60. My input signal (to be compared) is put on pin 10 (ACMP2-)

I have programmed ACMP2 :

ACMP2SC = 0xD0;     /* Enabled, bandgap, int enabled, no out, falling edge of out */

 

I also use PTA1 as an analog measurement.

 

When PTA1 is greater than ~1.5 V all works fine.

 

When PTA1 is close to 0, I have unexpected ACMP2 interrupts, and the value read on ACMP2 output

(ACMP2SC & 0x08) is also corrupted.

 

For instance, I've removed all comparator features in my software and use PTF5 as digital input and my

system works fine without erroneous read data on PTF5.

 

My system is powered under 5V, xtal 4 MHz, bus clock 18 MHz and analog reference = 5 V

 

My question is :

Is there any influence of PTA (1 in my case) on ACMP2 ?

How could I avoid that ?

 

With best regards from France

francois

标签 (1)
0 项奖励
回复
4 回复数

566 次查看
bigmac
Specialist III

Hello Francois,

 

Did you also enable the bandgap reference output by setting the BGBE bit within the SPMSC1 register?

 

Regards,

Mac

 

0 项奖励
回复

566 次查看
Francois
Contributor I

Hello,

 

I think yes, I've put ACMP2SC = 0xD0

so ACBGS = 1

bit 0x40

 

francois

 

0 项奖励
回复

566 次查看
bigmac
Specialist III

Hello Francois,

 

In addition to being selected by the comparator module, the bandgap buffer also needs to be separately enabled.  This is mentioned in paragraph 9.1.1, and further detailed in paragraph 5.8.7 of my datasheet (a rather outdated preliminary version, so paragraph numbering may have changed).  Look for the details of the SPMSC1 register.

 

Regards,

Mac

 

0 项奖励
回复

566 次查看
Francois
Contributor I

Hello,

 

Thank you for you response,  my mistake was to have not enabled the bandgap in SPMSC1.

I've done it, It seems to work better, but I prefer to keep the information by reading the value of

the port directly.

If I've time, I'll look in detail if it works with the comparator.

 

Best regards from france

francois

0 项奖励
回复