1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

where do i learn bout PIC ?

Discussion in 'Microcontrollers' started by kupikupi, Aug 21, 2005.

  1. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    it is correct, but why did you lower the Baud rate?
    Are you sure that your PIC and MAX232 have good connection to com port? Did you select correct com port? Did you RESET the PIC after you pressed the PROGRAM/WRITE FLASH button?
     
  2. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    for the Baud rate, i just used the same one as when i run the terminal program, that was wat the lecturer told us to, but can i ask, is it that it's better to set a higher Baud rate?? for the com ports, i'm sure i had it right and working but i din reset the PIC after i write flash. i'll try again later // thanx Jay...
     
  3. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    Lower Baud rate will just make programming longer for a few seconds..
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK

    Why have you chosen to use the 18F4320 asm file to match your 18F452?

    You should use the 18F252 asm file instead. The author has use the following name for this file:

    "tinybld18F.asm"
     
  6. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    well... i thought that was the closest one... so should i use the asm file for F252 now ??
     
  7. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    Yes, 252 is much closer than 4320.
     
  8. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    Jay .. i need some advice and help here....

    i'm not so sure which pragramming language i should continue learning to complete my project .. my assembly language is really bad... though i'm beginning to understand programs in asembly .. i doubt if i could do one.. one the other hand, C programming .. i know a little bit more than assembly .. but also i can't do programs without any help .. but i can't find any guide on how to do C programming with PIC...

    now i've got to write a program which uses infrared tramsmission from a remote control to drive a motor to move the wheelchair. i'm still learning how the ADC works using the datasheet, but i dun quite get it .. it's really hard to understand since i has no prior knowledge on pic and i'm running out of time. i need some advice on wat i should do now?? im really confused..
     
  9. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    I still think Assembly is easier to do than C, ofcourse with Assmebly you have to type more and make your own sub-routines, but it's much more powerful than C. When I was learning C, it was very different comparing to PC C programming. Nigel's tutorials should explain everything!
     
  10. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    how do i modify Nigel's tutorial about IR transmission ot make it work on my 18F PIC?? do i have to change a lot of things ??
     
  11. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    No, basically it is the same... 18F doesn't use banking so things are a little but easier.
     
  12. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    so Jay , how do i modify this part?? just delete the banking parts??

    SetPorts bsf STATUS, RP0 ;select bank 1
    movlw 0x00 ;make all LED pins outputs
    movwf LED_TRIS
    movlw b'11111111' ;make all IR port pins inputs
    movwf IR_TRIS
    bcf STATUS, RP0 ;select bank 0

    call EE_Read ;restore previous settings
     
  13. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    Basically YES!
     
  14. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    could u tell how the IR send signal for the PIC the drive the motor??
    i only know this much ... but i got lots qustions.. i've tried Nigel's tutes and going thru the DAta sheet.... i can only understand half of it .. here it goes

    i use the Sony remote control to send signal to the PIC, the IR detector detects the analog signal and Nigel said that the IR detector converts it to digital signal to the PIC and from the digital signal, the PIC drives the motor. this is just the general view of it .. but i want to ask.

    1. does everyone button represent different pulse width ??
    2. how does the PIC measure the pulse width ? after measuring, how does it
    represent it as 1s and 0s??( do i assign it to be either 1 or 0?), if i have 2 instructions, i can have one instruction and 1 and the other as 0, but how bout if i have 4? will it be like this??
    4 instruction, 4 different pulse width ,represented as ( 00. 01. 10 11 )?

    thanx alot ....
     
  15. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    1. No! Every button is represented by a series of pulses, using standard IR encoding. Signal is modulated with ~36Khz, to supress natural IR radiation.

    2. Measuring pulse width is very easy, especially if the PIC has CCP -Capture Compare PWM unit...

    I don't have experiences with IR, maybe Nigel can help you more.
     
  16. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,235
    Likes:
    641
    Location:
    Derbyshire, UK
    1) No, each button represents a unique digital code, just like the buttons on your PC keyboard.

    2) The SIRC's system sends zero's and one's as different width pulse (with a third wider start bit), the PIC measures each pulse to see which it is, once a start pulse is detected it then measures and stores the next 12 bits (7 data bits, and 5 device bits). So with 7 data bits, you can have 127 different unique commands, the device bits are to ensure it's a command for this particular device.
     
  17. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    im beginning to understand how it works.... but i need more details on it ... sorry for the trouble ..

    so now i see that the remote transmits the signal, the IR detector detects it and converts it to digital signal in the form of pulses which is then input into one pin of the PIC.. since i'm using the sony remote... each button should already have its own pulse rite?? i need to know the measurement of the pulse( the measurement is done using ccp rite?) so that i can know which does what.. or could i just assign any pulse to any instruction ?? for example
    i got the 1st set as 1010101 .. so could just assign it for the instruction to reverse the motor??

    thanx
     
  18. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,235
    Likes:
    641
    Location:
    Derbyshire, UK
    My tutorial examples just use a software loop to measure the pulses, that way you can use any input pin on any PIC device.

    Yes, you can assign any key to any function you want, the values of some of the standard Sony buttons are listed in the software examples.
     
  19. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    Nigel, in ur tutes, i noticed that u used the IR detector called TFMS5360, is there any particular reason that u used that?? i found other detectors called TSOP1736 and TSOP1136, are there all the same ?? the 36 in those codes means 36kHz , is it different if i used 38k?? thanx.....
     
  20. kupikupi

    kupikupi New Member

    Joined:
    Aug 21, 2005
    Messages:
    84
    Likes:
    0
    Jay ... i found out a problem .... i uploaded the bootloader to the PIC thru the picstart plus.. but when i did a blank check on it .. it said device is blank ? what do u think is the problem ?? i kept uploading but to no avail .. maybe that's the reason why Tiny bootloader could not detect the PIC... do u think there's anything wrong with the codes?? thanx
     
  21. Jay.slovak

    Jay.slovak Active Member

    Joined:
    Jan 11, 2005
    Messages:
    1,726
    Likes:
    5
    Try to do Verify instead of Blank check!
     

Share This Page