18f4550 with Bootloader connected does not run program

General discussion on mikroElektronika website & forums.
Post Reply
Author
Message
David777
Posts: 26
Joined: 19 Sep 2014 20:01

18f4550 with Bootloader connected does not run program

#1 Post by David777 » 24 Jan 2016 21:40

Hi
I got the 18F4550 to connect to pc but found out that it doesn't go onto the rest of program so that i can't use the HID TERMINAL as the program I have written doesn't seem to run until I disconnect.
I'm new to this usb stuff so not sure where I'm going wrong can anybody help please I'm using mikrobasic pro.
Thanks in advance it could be much appreciated

Dave

User avatar
uros.cvetinovic
mikroElektronika team
Posts: 803
Joined: 14 Dec 2015 09:24

Re: 18f4550 with Bootloader connected does not run program

#2 Post by uros.cvetinovic » 26 Jan 2016 17:53

Hi,

What kind of hardware do you use?

How did you established connections?

Can you please be little more specified?

Best regards,

Uros Cvetinovic

David777
Posts: 26
Joined: 19 Sep 2014 20:01

Re: 18f4550 with Bootloader connected does not run program

#3 Post by David777 » 26 Jan 2016 19:55

Hi
Thank you for the reply i used the boot loader for the 8 MHz crystal and its working fine now.
The other problem i had was the polling the frequency was incorrect it connects ok now with the HID Terminal.
Just one last thing on this if you could help me please.
What's the best way to read some switches on portb with the 18f4550 i have set the port as INPUTS with TRISD = 0xff
I can read the switches as individual switches and that works ok, but i need to know if two switches are press at once.
I did try just reading the whole portd when i switch was pressed but didn't get the number from the port as expected.
Any help would be much appreciated thanks

Dave

User avatar
uros.cvetinovic
mikroElektronika team
Posts: 803
Joined: 14 Dec 2015 09:24

Re: 18f4550 with Bootloader connected does not run program

#4 Post by uros.cvetinovic » 27 Jan 2016 18:37

Hi,

Can you please confirm if I understood you right?
You want to know how many buttons are pressed at some point and which buttons are pressed?

Also, can you please zip and attach your project here?

Best regards,

Uros Cvetinovic

David777
Posts: 26
Joined: 19 Sep 2014 20:01

Re: 18f4550 with Bootloader connected does not run program

#5 Post by David777 » 28 Jan 2016 20:23

Hi guys
Thanks for you help I have Looked into the code and found a way to read the whole portb on a button press which seems to work ok.
When a button is pressed I send the port data to the USB by copying the port data to the writebuff I set it up by at the beginning.

HID_Write(@writebuff,64)

But because I used dim writebuff as byte[64] absolute 0x540 as in the exampe
It writes all 64 bytes to the pic.
When I transfer the port data to to writebuff it then writes all the 64 bytes and I only want the first one if all switches closed it says 255 but followed 63 zeros.
How can I stop it writing the 63 zeros after the first byte which shows me 255 which I the onlyart I want. As writing all the 64 bytes sends information I don't need and slows it down.
Thanks for you help

David

Post Reply

Return to “Website & Forums General Discussion”