Title: 8 bit baniary counter Post by: sadman on September 21, 2013, 10:21:18 10:21 hi
i have ported a c code to basic for 8 bit binary counter but my code is not working as original one can some one help me to fix this i have uploaded both original and ported code here with simulation file regards sadman Title: Re: 8 bit baniary counter Post by: Catcatcat on September 21, 2013, 03:53:18 15:53 Of course will not work, read here http://catcatcat.d-lan.dp.ua/en/skachat/primeryi-postroeniya-koda-programm-dlya-pic-kontrollerov/tsifrovoy-vvod-dannyih/ (http://catcatcat.d-lan.dp.ua/en/skachat/primeryi-postroeniya-koda-programm-dlya-pic-kontrollerov/tsifrovoy-vvod-dannyih/) if Google release translation understand, there is an example.
Title: Re: 8 bit baniary counter Post by: robotai on September 23, 2013, 03:50:32 03:50 In C code, we use "{..}" to form program block.
In Basic code, "If" should has related "End If" to form program control block. Obviously you missed it. Title: Re: 8 bit baniary counter Post by: sadman on September 23, 2013, 05:18:09 05:18 In C code, we use "{..}" to form program block. In Basic code, "If" should has related "End If" to form program control block. Obviously you missed it. can you please provide a example Title: Re: 8 bit baniary counter Post by: robotai on September 23, 2013, 05:59:21 05:59 Well, not sure what example you want? If you don't understand the syntax, maybe you need to study the BASIC language from the beginning.
For part of your code, it should looks like Code: If up=1 Then You didn't port the debounce part from C code exactly. Maybe you are using your way. Title: Re: 8 bit baniary counter Post by: ero on September 23, 2013, 06:12:46 06:12 Here is the working code;
Code: Device = 16F628 ero Title: Re: 8 bit baniary counter Post by: sadman on September 23, 2013, 07:20:03 07:20 Well, not sure what example you want? If you don't understand the syntax, maybe you need to study the BASIC language from the beginning. For part of your code, it should looks like Code: If up=1 Then You didn't port the debounce part from C code exactly. Maybe you are using your way. how i can add debounce part Title: Re: 8 bit baniary counter Post by: robotai on September 23, 2013, 08:01:12 08:01 I think ero has ported it for you on previous reply.
For better mechanism, you can refer to http://www.microchip.com/forums/m265696.aspx This is much like what I have usually used. Title: Re: 8 bit baniary counter Post by: sadman on September 24, 2013, 05:35:04 05:35 thank to all friends for the support finally i get it working as required
sadman |