Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

source code for checkers game using mikrobasic in pic16f877a to play vs PC

Status
Not open for further replies.

gLn_21

Newbie level 4
Joined
Feb 14, 2011
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,333
i have already done some codes for this game but i cannot finish it because of the message "ROM full" ive tried also to lessen the use of conditions but still im stuck in how to finish the game ...

il attach the code to here and hope you can help me finish the game's codes ...
 

Attachments

  • checker game.txt
    8 KB · Views: 70

Hi gLn_21,

Try to avoid using too many "Button()" for If conditions,
Once you read a button, set a flag for it, then check that flag in If conditions finally clear that flag. This may avoid repeatedly checking same button and lessen complexity.

Replace possible C code with assembly-snippets; (especially for If conditions and Delay())

Use as much as low values for your Delay routines (try not to use values higher than 255 and check any improvement)

Hope this helps you,
 

can u post an example codes of setting a flag for the buttons ,,and the replacing of c codes with assembly-snippets ...i really dont know how to do it alone
 

Hi,

You should read user manual to find how to insert assembly code to your compiler, also you should need some knowledge on assembly instructions (use datasheet of PIC)

following is pseudo code for how to replace Button(PORTB,2,1,0) and use of asm;

IF (PORTB.2=0) then
delay4btn()
if (PORTB.2=0) then

// Your code for "if Button(PORTB,2,1,0)" is true

End if

End if


There delay4btn() is a procedure written in assembly for debounce-delay of switch.

sub procedure delay4btn()

asm
movlw 255

L1_start_check

decf Wreg,W
btfsc STATUS,Z
goto L2_exit_check
nop
nop
nop
nop
nop
nop
goto L1_start_check

L2_exit_check
end asm

END SUB

Hope this helps you,
 

Hi DineshSL,

thanks for the reply this pseudocode helps me to lessen the use of codes that make the message "ROM full" ,,i have another favor to ask ,,can u give me some pseudocode about building an "english checkers game" using mikrobasic, using what u have thought me earlier ...im hoping for a complete pseudocode ..

.many thanks
 

Hi,

Algorithm for such kind of game playing is described on subject Game Theory.

I suggest you to use PIC18 series PIC for your task. They have more memory and better support on C language.

Thank you,
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top