From Asm to Pascal

Please check the frequently asked questions before posting to the forum.
Post Reply
Author
Message
cpri
Posts: 82
Joined: 27 Jul 2005 09:29

From Asm to Pascal

#1 Post by cpri » 29 Aug 2005 15:10

I've got some asm code wich reacts in a very basic way to the SPI protocol.
This cod is written in asm. I want to convert this code to Pascal
Now I do understand the way the program works. But I don't know the functions I have to use in Pascal I hope someone can help me with this
To keep it simple I want to do it bit by bit

Code: Select all

Check4Data
		movlw 	SSPSTAT			; test op data
		movwf 	FSR
		btfss	INDF,BF
		goto 	Check4Data

ReadData	; Check data indien bit 0 = 1 Led aan
		movf	SSPBUF,W		; lees rx buffer
		movwf	TmpRx			; zet in Tmp


		sublw	0x0				; Test of data == 0  en doe niets
		btfsc	STATUS,C		; skip if C = 0		Status  C = 1 als data = 0    
		goto	Check4Data

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: From Asm to Pascal

#2 Post by zristic » 29 Aug 2005 15:49

This assembly is not for dsPIC. :?:

cpri
Posts: 82
Joined: 27 Jul 2005 09:29

#3 Post by cpri » 30 Aug 2005 06:45

Sorry it should be posted in general Pascal for pics (without the ds)
Is there somebody you can put this post in the right forum (MikroPascal General) or should I repost it in there ??

JARETAMAR
Posts: 17
Joined: 12 Nov 2005 18:21
Location: San Francisco, Córdoba, Argentina

Pascal equivalent

#4 Post by JARETAMAR » 30 Dec 2005 05:14

The following is the equvalent pascal code:

Code: Select all

Var
  TmpRX : Byte;
begin
// Check4Data
  repeat
    repeat
      FSR := SSPSTAT;  // test op data
    until INDF.BF = 1;
    // ReadData   ; Check data indien bit 0 = 1 Led aan
    TmpRX:= SSPBUF; // lees rx buffer and zet in Tmp
  until TmpRx <> 0; //  Test of data <> 0
end.

Post Reply

Return to “mikroPascal FAQ”