Author Topic: N76E003 pin high/low takes larger time  (Read 760 times)

0 Members and 1 Guest are viewing this topic.

Offline Vindhyachal.taknikiTopic starter

  • Frequent Contributor
  • **
  • Posts: 488
N76E003 pin high/low takes larger time
« on: May 27, 2019, 01:52:21 pm »
1. I am using N76E003, keil v9.51 .  Controller is running at 16Mhz, I can measure this on Clockout pin by DSO.

2. Internal clock diagram shows, Clockout frequency & peripheral frequency is same. 

3. Timers works correctly accroding to 16Mhz clock.

4. Issue I faced is when I write:

P04   = 0; or P04   = 1;

it takes around 250ns as measured on DSo with 10x probe for single instruction.


5. Disassembly on keil shows:

C:0x07FE    C284     CLR      P04(0x80.4)
C:0x0800    D284     SETB     P04(0x80.4)



6. These are single cycle instruction. What I dont understand is when cpu is running at 16Mhz,  single cycle time should be 1/16Mhz i.e 62.5ns, but on DSO it takes 250ns around

7. Then why pin high low takes large time
 

Offline garethw

  • Regular Contributor
  • *
  • Posts: 88
  • Country: gb
Re: N76E003 pin high/low takes larger time
« Reply #1 on: May 27, 2019, 02:27:19 pm »
Clock cycles and machine cycles are not the same.
For example: Your clock is 16MHz. If your mcu is running 4 clock cycles per machine cycle then each instruction takes 1 / 4MHz = 250ns.
The data sheet will explain how long each instruction will take in machine cycles as well as how long a machine cycle is.


Sent from my iPhone using Tapatalk
Father
Husband
MENG Electronic Engineering student
 

Offline garethw

  • Regular Contributor
  • *
  • Posts: 88
  • Country: gb
Re: N76E003 pin high/low takes larger time
« Reply #2 on: May 27, 2019, 02:47:05 pm »
Checking the N76E003 datasheet reveals:
1 clock cycle per Machine cycle.
SETB (set bit) = 4 Machine cycles
CLR (clear bit) = 4 Machine cycles

Hope that helps

Gareth
Father
Husband
MENG Electronic Engineering student
 

Offline Vindhyachal.taknikiTopic starter

  • Frequent Contributor
  • **
  • Posts: 488
Re: N76E003 pin high/low takes larger time
« Reply #3 on: May 28, 2019, 05:42:20 am »
thanks
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf