DynamicRC ±¤ÆÒ Ä¿¹Â´ÏƼ¿¡ ¿À½Å °ÍÀ» ȯ¿µÇÕ´Ï´Ù!
DynamicRC ±¤ÆÒ Ä¿¹Â´ÏƼ

°Ô½ÃÆÇ ÅëÇÕ°Ë»ö help
subject/ name/ content/ comment

°øÁö»çÇ× ÀÚÀ¯°Ô½ÃÆÇ QnA Á¦ÀÛÀÏÁö ºñÇàÀÏÁö
RCÀüÀÚ°øÀÛ MCU STUDY IR¡¤RF ÀÚ·á½Ç Link ¿¾³¯ ÇÁ·ÎÁ§Æ®·ë

* *

 tiny10 pwm2ppm ÄÁ¹öÅÍ

2012-04-29 03:00:38, Hit : 6457

ÀÛ¼ºÀÚ : ÀÌÇÐÁ¾
- Download #1 : A013___20120429_023552.jpg(488.1 KB), Download : 68
¿ø·¡Å©±â·Îº¸±â

tiny10À¸·Î pwm2ppm ÄÁ¹öÅ͸¦ ¸¸µé¾ú½À´Ï´Ù.
2chµµ ÃæºÐÈ÷ ÇÒ ¼ö ÀÖ°í Äڵ嵵 ÀÖÁö¸¸ Å×½ºÆ®¸¦ ¾ÈÇغÁ¼­ 1chÂ¥¸®¸¦ ¿Ã¸³´Ï´Ù.
À̰͵µ »ó´çÈ÷ ´õ Æí¸®ÇÏ°í ÁÁ°Ô ´ÙµëÀ» ¼ö Àִµ¥ ±¸ÂùÀ¸´Ï±î ±¸³É ¾µ¶ø´Ï´Ù.

tiny13À» ¾´°Ô °ø°³µÇ¾î ÀÖÁö¸¸ º¯¼Ó±â¿¡ ±â»ýÇϱ⿡´Â Å©±â°¡ Á» Å®´Ï´Ù.
ÀÌ°Å´Â º¯¼Ó±â¿¡ ÀÛÀº °ø°£ÀÌ¶óµµ ºñÁý°í µé¾î°¡¼­ ±â¼ººÎǰó·³ ÀÚ¸®ÀâÀ» ¼ö ÀÖ½À´Ï´Ù.
»ç¿ëÇÏÁö ¾Ê´Â 2ÇÉÀº hi ÀÓÇÇ´ø½º·Î ó¸®Çؼ­ Àü¿ø´ÜÀÚ¿Í ¼îÆ®½ÃÄѵµ ¹«¹æÇÏ°ÔÇؼ­ ºÎÂøÀ» ½±°Ô Çß½À´Ï´Ù.


/*****************************************************
**********    attiny10 pwm2ppm ÄÁ¹öÅÍ 1CH  ***********
******************************************************
        tiny10
      (data)  (rst)
      PB0-[..]-PB3
(-)-- GND-[..]-VCC --(+)
out<- PB1-[..]-PB2 <-in
(clk)

¼­º¸½ÅÈ£ ___-_______--___   ÁÖ±â:16ms ÆÞ½ºÆø:1~2ms
PB0,3 : high ÀÓÇÇ´ø½º(ÀÔ·Â)
PB1 : ppm½ÅÈ£ out
PB2 : pwm½ÅÈ£ in
                            2012³â 4¿ù 29ÀÏ ÀÌÇÐÁ¾ ¸¸µê
******************************************************/

;     8Mhz ½Ã½ºÅÛ¿¡¼­ 1msec¿¡ »ó´çÇϴ Ŭ·°¼ö
;     8000ȸ / 10Ŭ·°(·çÇÁ´ç) = 800

.equ CNT_1MS  = (8000 / 10)
.equ PWM_IN  = PB2  ; PB2
.equ PPM_OUT  = PB1  ; PB1
.equ PERIOD_MS = 22  ; 19 ÀÌ»ó ±ÇÀå

.def cnt_h  = r16
.def cnt_l  = r17
.def loop_h  = r18
.def loop_l  = r19
.def set_timer = r20
.def temp1  = r21
.def temp2  = r22
.def i_temp1  = r23  ; interrupt temporary
.def i_temp2  = r24  ; interrupt temporary
.def i_sreg  = r25  ; interrupt temporary
;#####################################################
.cseg
.org 0
  rjmp reset
  nop ; ext0_int
  nop ; pci0_int
  nop ; capt0_int
  rjmp  ovf0_int
  nop ; ccma_int
  nop ; ccmb_int
  nop ; comp_int
  nop ; wdc
  nop ; vlm
  nop ; adc

version:.db "pwm2ppm_1 v1.0"

;#####################################################
reset:
;#####  8Mhz ÁöÁ¤  
  ldi  temp1, 0xd8
  ldi  temp2, 0
  out  CCP, temp1
  out  CLKMSR, temp2

  out  CCP, temp1
  out  CLKPSR, temp2

;#####  ÃʱâÈ­
  ldi  temp1, (1<<PWM_IN) ; PPM_IN pull-up
  out  PORTB, temp1
  ldi  temp1, (1<<PPM_OUT) ; PPM_OUT¸¸ Ãâ·ÂÀ¸·Î ¼³Á¤
  out  DDRB, temp1

  ldi  temp1, 2  ; (1,2,3,4,5) => clk / (1,8,64,256,1024)
  out  TCCR0B, temp1
  ldi  temp1, (1 << TOIE0)
  out  TIMSK0, temp1
  ser  set_timer
  ldi  temp1,  high(65536 - (1000*PERIOD_MS))
  ldi  temp2,  low (65536 - (1000*PERIOD_MS))
  out  TCNT0H,   temp1
  out  TCNT0L,   temp2

  cbi  PORTB, PPM_OUT ; ppm ½ÅÈ£¸¦ '0'À¸·Î
  sei

;#####################################################
;##### ¸ÞÀηçÇÁ
loop:
  ldi  loop_h, high  (CNT_1MS * 16)  // PERIOD 16msÃÊ
  ldi  loop_l, low   (CNT_1MS * 16)
  clr  cnt_h
  clr  cnt_l

;##### 16msµ¿¾È PB1ÀÇ ½ÅÈ£°¡ '1'ÀΠȽ¼ö¸¦ Ä«¿îÆ®ÇÏ¿© cnt_h,l¿¡ ÀúÀå
  clr  temp1
  clr  temp2
count_on:    // 11*(loop_l+1) + (14 + 11*255)*loop_h
  sbis PINB, PWM_IN  ; pwm½ÅÈ£°¡ '1'À̸é Á¡ÇÁ
  ldi  temp1, 0
  sbic PINB, PWM_IN  ; pwm½ÅÈ£°¡ '0'À̸é Á¡ÇÁ
  ldi  temp1, 1
  add  cnt_l, temp1
  adc  cnt_h, temp2

  dec  loop_l
  cpi  loop_l, 0xff
  brne count_on
  dec  loop_h
  cpi  loop_h, 0xff
  brne count_on

;##### º¯¼ö°ª ÀúÀå
; loop_l,h <- CNT_1MS + Ãß°¡ÇÒ ÆÞ½ºÆø
  ldi  loop_l, low (CNT_1MS)
  ldi  loop_h, high(CNT_1MS)
  lsr  cnt_h
  ror  cnt_l
  lsr  cnt_h
  ror  cnt_l
  lsr  cnt_h
  ror  cnt_l
  lsr  cnt_h
  ror  cnt_l ; cnt / 16 ... 1msµ¿¾È Ä«¿îÆ®µÈ '1'ÀÇ ¼ö

  add  loop_l, cnt_l
  adc  loop_h, cnt_h

;#####  ppm ÆÞ½º Ãâ·Â
  clr  temp1
  clr  temp2
  sbi  PORTB,  PPM_OUT ; ppm½ÅÈ£¸¦ '1'·Î
delay_plus:
  sbis PINB, PWM_IN
  ldi  temp1, 0
  sbic PINB, PWM_IN
  ldi  temp1, 0
  add  cnt_l, temp1
  add  cnt_h, temp2

  dec  loop_l
  cpi  loop_l, 0xff
  brne delay_plus
  dec  loop_h
  cpi  loop_h, 0xff
  brne delay_plus

  cbi  PORTB, PPM_OUT ; ppm ½ÅÈ£¸¦ '0'À¸·Î
  ser  set_timer
wait_tmr:
  tst  set_timer
  brne wait_tmr
    
  rjmp loop

;#####################################################
;#####  timer interrupt
ovf0_int:
  in  i_sreg,  SREG

  clr  set_timer
  ldi  i_temp1,  high(65536 - (1000*PERIOD_MS))
  ldi  i_temp2,  low (65536 - (1000*PERIOD_MS))
  out  TCNT0H,   i_temp1
  out  TCNT0L,   i_temp2

  out  SREG,   i_sreg
  reti

.exit

;#####################################################

/*
AVR Studio 5.0¿¡¼­ ÄÄÆÄÀÏ
pwm2ppm_xy.hex : PBx(in)--->PBy(out)

ex)pwm2pp_01.hex : PB0(pwm input)--->PB1(ppm out)

### pwm2ppm_01.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300051E052B952E051B952E05DBD51E05BBDB3
:100040004FEF5AEA60E159BD68BD1198789422E3F8
:1000500030E00027112755276627009B50E00099C4
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627119A4A
:10009000009B50E0009950E0150F060F3A953F3F46
:1000A000B9F72A952F3FA1F711984FEF4423F1F7A5
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_02.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300051E052B954E051B952E05DBD51E05BBDB1
:100040004FEF5AEA60E159BD68BD1298789422E3F7
:1000500030E00027112755276627009B50E00099C4
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627129A49
:10009000009B50E0009950E0150F060F3A953F3F46
:1000A000B9F72A952F3FA1F712984FEF4423F1F7A4
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_03.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300051E052B958E051B952E05DBD51E05BBDAD
:100040004FEF5AEA60E159BD68BD1398789422E3F6
:1000500030E00027112755276627009B50E00099C4
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627139A48
:10009000009B50E0009950E0150F060F3A953F3F46
:1000A000B9F72A952F3FA1F713984FEF4423F1F7A3
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_10.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300052E052B951E051B952E05DBD51E05BBDB3
:100040004FEF5AEA60E159BD68BD1098789422E3F9
:1000500030E00027112755276627019B50E00199C2
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627109A4B
:10009000019B50E0019950E0150F060F3A953F3F44
:1000A000B9F72A952F3FA1F710984FEF4423F1F7A6
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_12.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300052E052B954E051B952E05DBD51E05BBDB0
:100040004FEF5AEA60E159BD68BD1298789422E3F7
:1000500030E00027112755276627019B50E00199C2
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627129A49
:10009000019B50E0019950E0150F060F3A953F3F44
:1000A000B9F72A952F3FA1F712984FEF4423F1F7A4
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_13.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300052E052B958E051B952E05DBD51E05BBDAC
:100040004FEF5AEA60E159BD68BD1398789422E3F6
:1000500030E00027112755276627019B50E00199C2
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627139A48
:10009000019B50E0019950E0150F060F3A953F3F44
:1000A000B9F72A952F3FA1F713984FEF4423F1F7A3
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_20.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300054E052B951E051B952E05DBD51E05BBDB1
:100040004FEF5AEA60E159BD68BD1098789422E3F9
:1000500030E00027112755276627029B50E00299C0
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627109A4B
:10009000029B50E0029950E0150F060F3A953F3F42
:1000A000B9F72A952F3FA1F710984FEF4423F1F7A6
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_21.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300054E052B952E051B952E05DBD51E05BBDB0
:100040004FEF5AEA60E159BD68BD1198789422E3F8
:1000500030E00027112755276627029B50E00299C0
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627119A4A
:10009000029B50E0029950E0150F060F3A953F3F42
:1000A000B9F72A952F3FA1F711984FEF4423F1F7A5
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_23.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300054E052B958E051B952E05DBD51E05BBDAA
:100040004FEF5AEA60E159BD68BD1398789422E3F6
:1000500030E00027112755276627029B50E00299C0
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627139A48
:10009000029B50E0029950E0150F060F3A953F3F42
:1000A000B9F72A952F3FA1F713984FEF4423F1F7A3
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_30.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300058E052B951E051B952E05DBD51E05BBDAD
:100040004FEF5AEA60E159BD68BD1098789422E3F9
:1000500030E00027112755276627039B50E00399BE
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627109A4B
:10009000039B50E0039950E0150F060F3A953F3F40
:1000A000B9F72A952F3FA1F710984FEF4423F1F7A6
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_31.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300058E052B952E051B952E05DBD51E05BBDAC
:100040004FEF5AEA60E159BD68BD1198789422E3F8
:1000500030E00027112755276627039B50E00399BE
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627119A4A
:10009000039B50E0039950E0150F060F3A953F3F40
:1000A000B9F72A952F3FA1F711984FEF4423F1F7A5
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

### pwm2ppm_32.hex ###
:020000020000FC
:1000000011C000000000000054C00000000000000B
:1000100000000000000070776D3270706D5F31205D
:1000200076312E3058ED60E05CBF67BF5CBF66BFC5
:1000300058E052B954E051B952E05DBD51E05BBDAA
:100040004FEF5AEA60E159BD68BD1298789422E3F7
:1000500030E00027112755276627039B50E00399BE
:1000600051E0150F061F3A953F3FB9F72A952F3FEC
:10007000A1F730E223E006951795069517950695AA
:10008000179506951795310F201F55276627129A49
:10009000039B50E0039950E0150F060F3A953F3F40
:1000A000B9F72A952F3FA1F712984FEF4423F1F7A4
:1000B000CECF9FB744277AEA80E179BD88BD9FBF44
:0200C000189591
:00000001FF

*/

 




ÀÌÇÐÁ¾
Âü, »çÁø¿¡ ÀÖ´Â t10Àº Àü½Ã¿ëÀÌ°í ½ÇÁ¦´Â µÚÁý¾î¼­ ³³¶¬µÇ¾î ÀÖ½À´Ï´Ù. 2012-04-29
03:03:41

¼öÁ¤  
±è¿µÀÏ
À̽𣿡 Àá µéÁö¾ÊÀº 2ÀÎÀÔ´Ï´Ù.
ÀÌÀÛÇ°À» óÀ½º¸½Ã´Â ºÐÀº ÀÌ °ÍÀÇ ¸ñÀûÀ» ±Ã±ÝÇØ ÇÏ½Ç°Í °°Àºµ¥¿ä. ºÎ¿¬¼³¸íµµ
ºÎŹÇÕ´Ï´Ù.
2012-04-29
03:11:06

¼öÁ¤  
¹ÚÀç·®
PWM 2 PPMÀ̶ó¸é Àû¿Ü¼± ¼ö½Å±â¿¡¼­³ª¿À´Â PWMÆÄÇüÀ» ÀÏ¹Ý º¯¼Ó±â¿¡ ¾µ¼öÀÖµµ·Ï PPMÀ¸·Î ¹Ù²Ù¾îÁØ´Ù ¶ó´Â°Í Àΰ¡¿ä?
ÀÛÀº ºÎÇ°Çϳª Ãß°¡·Î Àû¿Ü¼± ¼ö½Å±â¿¡¼­ ºê·¯½¬¸®½ºµµ ¾µ¼öÀÖ°Ú³×¿ä ¤¾¤¾
2012-04-29
09:42:37

¼öÁ¤ »èÁ¦
±èâ¹®
¾î´À hexÆÄÀÏÀ» ¾²´Â°Ç°¡¿ä? °íÀÌÂî»çÀÌÆ®¿¡µµ °°Àº °ÍÀÌ ÀÖ¾î Àü¿¡ ¸¸µé¾î º¸¾Ò´Âµ¥ Àß ÀÛµ¿ÇÏ´õ±º¿ä. PIC10F200 À» ¾¹´Ï´Ù. 2012-04-29
13:32:02

¼öÁ¤ »èÁ¦
ÀÌÇÐÁ¾
´Ù¸® 4°³Áß¿¡ 2°³¸¦ ¼±ÅÃÇؼ­ Çϳª´Â ÀÔ,Çϳª´Â Ãâ·ÂÀ¸·Î ¾²´Â°ÅÁÒ. ±×·¯´Ï±î 4C2 * 2 = 12°¡Áö°¡ ÀÖ¾î¿ä.
³¡¿¡ÀÖ´Â ¼ýÀÚ 32 ¶ó¸é B3À» ÀÔ·Â B2¸¦ Ãâ·ÂÀ¸·Î ¾²´Â ÄÚµåÀÔ´Ï´Ù.
³¡¿¡ÀÖ´Â ¼ýÀÚ 01 À̶ó¸é B0À» ÀÔ·Â B1¸¦ Ãâ·ÂÀ¸·Î ¾²´Â ÄÚµåÀÔ´Ï´Ù.
2012-04-29
18:41:27

¼öÁ¤  
À±ÇÑ´ö
¿À~ ¸ÚÁý´Ï´Ù. ±×·±µ¥ ¾îµð¿¡ ¾²´Â ÁÙÀº ¸ð¸£°í ÀÖ´Â 1ÀÎ.... 2012-04-30
02:02:32

¼öÁ¤  
Á¤À籤
ºê·¯½Ã¿ë Çï±â³ª ±âü¸¦ ºê·¯½Ã¸®½ºÈ­ ÇÏ½Ç ¸ñÀûÀÎ °Í °°½À´Ï´Ù. »ó¿ë±âÆÇ¿¡¼­ ³ª¿À´Â ºê·¯½Ã¸ðÅÍ¿ë pwm ½ÅÈ£¸¦ ppm ½ÅÈ£·Î º¯È¯ÇÏ¸é ºê·¯½Ã¸®½º ¸ðÅ͸¦ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. 2012-04-30
21:21:41

¼öÁ¤  

¡â ¹öÆ°ÀÔ·Â ÇÁ·Î±×·¥¼Ò½ºÁ» ±¸ÇÒ¼ö ÀÖÀ»±î¿ä? [2]
¡ä ATTiny10 - 6ÇÉÂ¥¸® ÃÖ¼ÒÇü 8bit MCU¿¡ ÇÁ·Î±×·¥ ½á³Ö±â

Copyright 1999-2024 Zeroboard / skin by ¶Ç¹Ì
Copyright 2003-2010 DYNAMICRC.COM All rights reserved