Kod dönüşümü yardımı

Başlatan erhang, 25 Temmuz 2020, 14:35:27

erhang

Device 16F88
 
Xtal 4
Declare All_Digital TRUE
TRISA =%00000011
TRISB =%00000000
PORTA =0
PORTB =0   



ANSEL =%00000011
'ADCON1 =%10000000
ADCON0 =%00000001
OPTION_REG =%10000000
CMCON =7           
Declare Adin_Res = 10 ' 10-bit result required
Declare Adin_Tad =32_FOSC
Declare Adin_Delay =5
DelayMS 300




Symbol ScLk =PORTB.5
Symbol cS =PORTB.4
Symbol dTa =PORTB.6
Symbol LdAc =PORTB.7

A1_dEgIsKeN:

Dim AdC0 As Word
Dim AdC1 As Word
Dim Ad0 As Word
Dim Ad1 As Word
Symbol bIr =%1001
Symbol IkI =%0001
B0_oNmaIn:


LdAc =1
cS =1

MaIn:
AdC0 =ADIn 0
While ADCON0.1 =1 :Wend
 Ad0 =AdC0 *4
cS =0
SHOut dTa, ScLk, MsbFirst, [bIr\4,Ad0\12]       
cS =1
DelayUS 10
LdAc =0
DelayMS 1
LdAc =1
DelayMS 100

AdC1 =ADIn 1
While ADCON0.1 =1 :Wend
 Ad1 =AdC1 *4
cS =0
SHOut dTa, ScLk, MsbFirst, [IkI\4,Ad1\12]       
cS =1
DelayUS 10
LdAc =0
DelayMS 1
LdAc =1
DelayMS 100
GoTo MaIn
End



Bu kodu pbp da kullanmam için cevrimi konusunda yardımcı olacak arkadas varsa yardımcı olabilirmi

ete

'Device 16F88
#CONFIG
 __CONFIG  _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_IO
 __CONFIG  _CONFIG2, _IESO_OFF & _FCMEN_OFF
#ENDCONFIG

;@ __CONFIG  _CONFIG1, _CP_OFF & _CCP1_RB0 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF & _INTRC_IO
;@ __CONFIG  _CONFIG2, _IESO_OFF & _FCMEN_OFF

define OSC 4
OSCCON=%01101100
CMCON=7
OPTION_REG.7=1

PORTA=0:TRISA=%00000011
PORTB=0:TRISB=%00000000
ANSEL=%00000011 
DEFINE ADC_BITS 10     ' ADCIN resolution  (Bits)
DEFINE ADC_CLOCK 1     ' ADC clock source  (Fosc/8)
DEFINE ADC_SAMPLEUS 11 ' ADC sampling time (uSec)


Symbol ScLk =PORTB.5
Symbol cS =PORTB.4
Symbol dTa =PORTB.6
Symbol LdAc =PORTB.7
Symbol bIr =%1001
Symbol IkI =%0001  

A1_dEgIsKeN:
AdC0 var Word
AdC1 var Word
Ad0 var Word
Ad1 var Word

         
pause 300

B0_oNmaIn:


LdAc =1
cS =1

MaIn:
     adcin 0,AdC0
     Ad0 =AdC0 *4
     cS =0
     shiftout dTa, ScLk, 1, [bIr\4,Ad0\12]       
     cS =1
     pauseus 10
     LdAc =0
     pause 1
     LdAc =1
     pause 100

     ADCIN 1,AdC1
     Ad1 =AdC1 *4
     cS =0
     SHIFTOUT dTa, ScLk, 1, [IkI\4,Ad1\12]       
     cS =1
     PAUSE 10
     LdAc =0
     PAUSE 1
     LdAc =1
     PAUSE 100
     GoTo MaIn
End

erhang

Cok cok sagolun hocam ellerinize saglık tesekkurler

Powered by EzPortal