Searching \ for '[PIC] Using USB with the 18F4520!' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=18F
Search entire site for: 'Using USB with the 18F4520!'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] Using USB with the 18F4520!'
2017\11\14@072400 by Richard Pope

picon face
HELLO ALL,
.. . . . I could really use some help with using USB on the PIC 18F4520. I am going to use a FTDI USB to RS232 converter to talk to the PIC 18F4520 Through the RX and TX Pins. I want to send Configuration Code to a 24C512 serial EPROM. When I add additional devices I want to be able to update the EPROM. I also want to be able to use a Win 8.1 64bit Pro PC to control the Programmer. I also do a lot of searching and research on materials that I acquire from the MicroChip website. I have been reading the MC USB Device Firmware Framework User's Guide.
 . . . . I have the latest version of MpLab, and the latest versions of the X8, X18, and X32 Compilers installed. I also see that I need to install the latest versions of C30 C and C18 C Compilers and setup the proper Paths for these files. I don't mind doing the footwork. I am Disabled and retired. This gives me a lot of free time.
Thanks,

Richard R. Pope
1230 19th Street #5
Reedsburg, WI 53959, USA
1-608-768-7448
spam_OUTmechanic_2TakeThisOuTspamcharter.net


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@072819 by Clint Jay

picon face
I'm a little confused but the way I read your message would suggest that
you're going to connect your PIC to the PC with an FTDI USB to serial
device?

Or have I misunderstood and you're hoping to connect the PIC to the FTDI
with USB?

On 14 Nov 2017 12:25, "Richard Pope" <.....mechanic_2KILLspamspam@spam@charter.net> wrote:

HELLO ALL,
.. . . . I could really use some help with using USB on the PIC 18F4520.
I am going to use a FTDI USB to RS232 converter to talk to the PIC
18F4520 Through the RX and TX Pins. I want to send Configuration Code to
a 24C512 serial EPROM. When I add additional devices I want to be able
to update the EPROM. I also want to be able to use a Win 8.1 64bit Pro
PC to control the Programmer. I also do a lot of searching and research
on materials that I acquire from the MicroChip website. I have been
reading the MC USB Device Firmware Framework User's Guide.
 . . . . I have the latest version of MpLab, and the latest versions of
the X8, X18, and X32 Compilers installed. I also see that I need to
install the latest versions of C30 C and C18 C Compilers and setup the
proper Paths for these files. I don't mind doing the footwork. I am
Disabled and retired. This gives me a lot of free time.
Thanks,

Richard R. Pope
1230 19th Street #5
Reedsburg, WI 53959, USA
1-608-768-7448
mechanic_2spamKILLspamcharter.net


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@073634 by Richard Pope

picon face
Clint,
    Yes, I am using a FTDI to RS232 converter to hook the PC to the PIC. I just found out that all that I need to do is treat the connection to the PIC as a Serial connection. Is there a MC Serial Library available? I'm the one that was confused.
Thanks,
rich!

On 11/14/2017 6:28 AM, Clint Jay wrote:
{Quote hidden}

-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@074728 by Clint Jay

picon face
There may be, I've usually just rolled my own routines to service the
EUSART though I haven't used the '4520 specifically.

I don't think there are huge differences between most EUSART enabled mid
range devices so there should be plenty of example code to examine and
modify for your needs.

You'll need a level translator if you're going PIC to PC directly.

On 14 Nov 2017 12:36, "Richard Pope" <mechanic_2spamspam_OUTcharter.net> wrote:

{Quote hidden}

-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@075619 by Richard Pope

picon face
Clint,
    I'll do that this evening after I get up. I appreciate the insight and help! I will probably have to use a MAX232 to do the level translation. I appreciate you reminding me of that.
Thanks,
rich!

On 11/14/2017 6:47 AM, Clint Jay wrote:
{Quote hidden}

-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@085428 by Anthony Nixon

picon face
You wont need a level translator with the FTDI chip. It will directly
interface to the PIC, and the FTDI directly interfaces to the USB port
with the right support components which are just a handful of
passives.

The trick is whether or not the FTDI will be powered by the USB port
or by the PIC circuit.

cheers

Tony

On Tue, Nov 14, 2017 at 11:56 PM, Richard Pope <RemoveMEmechanic_2spamTakeThisOuTcharter.net> wrote:
{Quote hidden}

-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@095451 by Byron Jeff

flavicon
face
Tony,

There are actually two types of FTDI serial ports. There is the RS232 one
with a DB9 connector on the end. Typically that port will signal between
+/- 7 volts or so. Then there are the small FTDI TTL serial adapters.
Depending on configuration they will swing either between 0 and 5 volts or
0 and 3.3 volts.

In today's serial PC world rarely does an actual MAX232 need to be used for
level translation. Even with actual RS232 ports, virtually all of them
signal properly with a 0/5V TTL signal. Note that the sign is inverted such
that a logical 1 is represented by 0V and a zero by 5V.

For years I've used a simple voltage clamp to limit the swings. The basic
circuit is here: https://i.stack.imgur.com/jyZvD.gif D1 conducts when Vin
is above VMax and D2 conducts then Vin is below Vmin. R limits the current.
I typically put a second resistor after the clamp. I find that 1K for both
works well with PIC inputs.

A couple of variations are helpful. If D1 and D2 are Schotty diodes then
the voltage overshoot is typically only 0.3V or so. Also if D2 is a Zener
then D1 is unnecessary because the Zener action will limit the high voltage
while normal conduction clamps the low voltage.

With the signal inverted there are a few things you can do to manage it.
I've been using PIC24FV parts for several years. The hardware EUARTS on
them can be inverted in software. It is also possible to bit bang a digital
input/output for serial. Otherwise a NPN transistor whose base is connected
to Vout, emitter grounded, and a pullup collector will invert the signal in
hardware.

Another thought that may be traitorous on this board: ever considered an
Arduino? Complete boards with the USB serial adapter on board clock in at
about $5 USD. Boards like a Nano will plug right into a breadboard. Plug in
a USB cable, load the Arduino IDE and you're going literally in about 5
minutes. Tons of libraries already built into the platform.

As I've progressed in the hobby, I find that sometimes it's just more
trouble than it's worth to try to roll everything from scratch. Back in the
PIC 16C54 days, the price and functionality was a compelling reason to
switch as compared to the alternatives. But in 2017 with high level boards
such as a Raspberry PI Zero W that runs Linux and having a complete wireles setup
for less than $10 USD and Arduino clones literally running 5 for $20, it
becomes more difficult to justify wiring up a board from scratch and
programming in assembly anymore. Those who have never done it may need the
experience. But those of us who have a closetfull of t-shirts with
'Assembly coder' emblazoned upon them? Not so much. I find now that I spend
more time and energy trying to match the hardware/firmware to the
application. It literally may be more adventageous to throw a RasPi ZeroW
into a problem to make a wireless remote light switch than any alternative for
example.

BAJ

On Wed, Nov 15, 2017 at 12:54:26AM +1100, Anthony Nixon wrote:
{Quote hidden}

-- Byron A. Jeff
Associate Professor: Department of Computer Science and Information Technology
College of Information and Mathematical Sciences
Clayton State University
http://faculty.clayton.edu/bjeff
-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@100944 by Clint Jay

picon face
Jeff, you raise good points but I would prefer to be safe than sorry,
designing/building and coding for the MAX232 or other serial driver will
ensure compatibility (as far as RS-232 is able to be compatible) with the
widest range of PCs and prevent anything 'unpleasant' happening if the
device is plugged into an unknown machine.

As heretical as it would seem I'd have to admit you may have a point about
Arduino, it's a known hardware platform that is proven to work.

Similarly, I've been exploring options with STM32 Blue Pill boards recently
but I still like and write code for PIC devices, as and when I need extra
horsepower I may well leave the PIC Path and move to ARM, they're *so*
cheap and have an abundance of facilities.



On 14 November 2017 at 14:54, Byron Jeff <byronjeffSTOPspamspamspam_OUTclayton.edu> wrote:

{Quote hidden}

--
Clint.

*No trees were harmed in the sending of this mail. However, a large number
of electrons were greatly inconvenienced.*
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@161821 by James Cameron

flavicon
face
Thanks for the STM32 Blue Pill reference.  An interesting looking board.

On Tue, Nov 14, 2017 at 03:04:26PM +0000, Clint Jay wrote:
{Quote hidden}

--
James Cameron
http://quozl.netrek.org/
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\14@184220 by Richard Pope

picon face
Hello James, Jeff, Tony,
    I considered the Arduino and the ATMEGA32 but I needed a lot of I/O
and I don't need CPP or Analog. Yes, there is more support for the
Arduino but there is a lot out there for the PIC. I could use some more
I/O pins. I am using shift registers to control the address lines going
to the programming socket and a 8 to 3 encoder chip for the interrupts.
    The FTDI chip that I am considering is a FT232RL. It will be
connected to the PIC in a direct manner and only the USB side will be
able to connect to a PC. I know that the RS232 port on the PIC swings 0
to 5 volts. I'll have to check the datasheet for the FT232RL to see if
it swings 0 to 3.3 or 5 volts. I don't know.
    I use C to do my coding. I understand Assembly to a certain point.
I am able to follow along the code and see what is going on but I have a
difficult time creating my own Assembly programs. I am going to run the
4520 at 40MHz so speed isn't going to be a big issue for the programmer.
Right now I am using relays to switch the Address lines and various
programming voltages to the appropriate pins on the programming socket.
     I found a program for controlling a LCD on the MC website. The
only problem is that I can't find where that Data Pins are being
defined. I found the definitions for the control lines.
Thanks,
rich!

On 11/14/2017 3:18 PM, James Cameron wrote:
{Quote hidden}

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\15@004528 by Chris Roper

picon face
Take a look at http://gcbasic.com/
It is a compiler, it supports your device, has drivers / examples for most
of what you have mentioned, is far easier than Assembler or C and is free.
To set up a serial connection via FTDI and control an LCD is only about
half a dozen lines of code in GCBASIC.
I also find that the code it generates is far better optimized than XC8
code.
It is a great way to get started but is by no means confined only to
beginners it had some very advanced capabilities, supports over 1100 chips
from the PIC and AVR families with full portability.

Cheers
Chris




On 15 November 2017 at 01:42, Richard Pope <@spam@mechanic_2RemoveMEspamEraseMEcharter.net> wrote:

{Quote hidden}

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\15@010113 by Richard Pope

picon face
Chris,
    I'll look in to it. Did you read my latest post on the the forum
about an idea to replace the relays with 74LS244N s and 74LS32Ns?
GOD Bless and Thanks,
rich!

On 11/14/2017 11:45 PM, Chris Roper wrote:
{Quote hidden}

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\15@120230 by Byron Jeff

flavicon
face
Rich,

I didn't see it. But if you are working with CMOS chips like the PIC it's
almost always better to use chips in the HCT family for interfacing. The
reason is that the inputs work properly with TTL voltage levels while the
outputs are nearly rail to rail. So a 3.3V input will generate a 5V output.

BAJ

On Wed, Nov 15, 2017 at 12:01:09AM -0600, Richard Pope wrote:
> Chris,
>      I'll look in to it. Did you read my latest post on the the forum
> about an idea to replace the relays with 74LS244N s and 74LS32Ns?
> GOD Bless and Thanks,
> rich!

[ Snipping... getting too long ]
BAJ

-- Byron A. Jeff
Associate Professor: Department of Computer Science and Information Technology
College of Information and Mathematical Sciences
Clayton State University
http://faculty.clayton.edu/bjeff
-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\15@162352 by Richard Pope

picon face
Bryan,
    I appreciate the information. I'll change them to HCTs. My understanding is that the HCTs don't have as much fan out ability. Is this correct?
Thanks,
rich!

On 11/15/2017 11:02 AM, Byron Jeff wrote:
{Quote hidden}

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\15@172931 by Isaac M. Bavaresco

picon face

The HCTs work only with 5V VDD. They recognize 2V and higher as logic
high to be compatible with TTL outputs and they require also 5V TTL supply.

If your board is 3.3V only they won't work.

Cheers,

Isaac



Em 15/11/2017 19:23, Richard Pope escreveu:
{Quote hidden}

---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus


--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

2017\11\15@173633 by Richard Pope

picon face

Issac,
    The board is 3.3V, 5V 12.5V, and 27.5V. I appreciate this.
Thanks,
rich!

On 11/15/2017 4:29 PM, Isaac M. Bavaresco wrote:
{Quote hidden}

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

2017\11\16@021037 by Trevor Hancock

flavicon
face

Hello, I am replying to the digest version of the list

I have recently gone through the process of communicating via serial
using a logic level ftdi - usb adapter, but with an older chip the
18F452, I am revisiting an old project.

I wanted to try mplabx so I have been porting from another compiler that
had some quirks I didn't want to deal with again.

Others have said the MCC (code configurator)  made things easy but the
older parts are not supported including the '452 and '4520.

There is a microchip library (plib) for mplab that supports the older
chips but is not included with xc8 download but can be downloaded and
installed separately.

I also found a 3 year old library that implements the arduino style
Serial.print() functions in mplabx but that took a lot of reworking to
make it work in the current mplabx and xc8 compiler.

My application will communicate to the serial port of a Raspberry Pi
through a 3v to 5v level converter, and parse json from a webapp to
control the original hardware.

If anyone is interested I am fine with posting my test code (messy - no
error checking or fault tolerance).

Where is the best place to post it? Too many lines of code might get
unwieldy for this list.

Regards
Trevor H
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

2017\11\16@031800 by RussellMc

face picon face

​
On 15 November 2017 at 18:45, Chris Roper <caroperspam_OUTspam@spam@gmail.com> wrote:

{Quote hidden}

URL invalid

*Garglabet search GCBASIC
<www.google.co.nz/search?num=50&source=hp&ei=pUgNWq3qJYuc0gTQ_6f4Cw&q=gcbasic&oq=gcbasic&gs_l=psy-ab.3..0l4j0i30k1l6.1397.3145.0.5310.8.7.0.0.0.0.386.688.3-2.2.0....0...1.1.64.psy-ab..6.2.688.0...0.V11K26OkOgk>
*-
many relevant results

including

GCBASIC - Source Forge -
http://gcbasic.sourceforge.net/Typesetter/index.php/Home

http://www.greatcowbasic.com/

http://www.greatcowbasic.com/gcb.html

http://www.best-microcontroller-projects.com/pic-basic-gcbasic-ezine4.html


    Russell



​

{Quote hidden}

--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist

2017\11\16@033241 by Chris Roper

picon face
Thanks Russell,

I have contacted the admin to let him know it is down, the domain was only
registered on Saturday so may be having teething troubles.
Of the alternatives you posted http://gcbasic.sourceforge.
net/Typesetter/index.php/Home is the officail one and the one that the
GCBASIC.com address was pointing too.

Cheers
Chris


URL invalid
>      Russell
-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

2017\11\16@052644 by Chris Roper

picon face
gcbasic.com/ is back online, thanks for pointing it out.


On 16 November 2017 at 10:32, Chris Roper <RemoveMEcaroperKILLspamspamTakeThisOuTgmail.com> wrote:

{Quote hidden}

-- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
mailman.mit.edu/mailman/listinfo/piclist
.

More... (looser matching)
- Last day of these posts
- In 2017 , 2018 only
- Today
- New search...