comparison code_part1/OSTC_code_asm_part1/ms5535.asm @ 469:f53aa96ff2f4

SPI for sensor in 32MHz
author heinrichsweikamp
date Thu, 06 Oct 2011 23:30:47 +0200
parents 2144f19fa1eb
children 422b9eeace4f
comparison
equal deleted inserted replaced
468:8d69c040b9fc 469:f53aa96ff2f4
428 bsf sensor_CLK 428 bsf sensor_CLK
429 nop 429 nop
430 nop 430 nop
431 nop 431 nop
432 nop 432 nop
433 nop 433 btfsc OSCCON,4 ; 32MHz Mode?
434 nop 434 rcall MS5535A_extra_wait ; Yes
435 bcf sensor_CLK 435 bcf sensor_CLK
436 return 436 return
437 437
438 reset_MS5535A_zero: 438 reset_MS5535A_zero:
439 bcf sensor_SDO 439 bcf sensor_SDO
441 bsf sensor_CLK 441 bsf sensor_CLK
442 nop 442 nop
443 nop 443 nop
444 nop 444 nop
445 nop 445 nop
446 nop 446 btfsc OSCCON,4 ; 32MHz Mode?
447 nop 447 rcall MS5535A_extra_wait ; Yes
448 bcf sensor_CLK 448 bcf sensor_CLK
449 return 449 return
450 450
451 MS5535A_extra_wait:
452 nop
453 nop
454 nop
455 nop
456 nop
457 return
458
451 reset_MS5535A: 459 reset_MS5535A:
452 rcall reset_MS5535A_one ;0 460 rcall reset_MS5535A_one ;0
453 rcall reset_MS5535A_zero 461 rcall reset_MS5535A_zero
454 rcall reset_MS5535A_one 462 rcall reset_MS5535A_one
455 rcall reset_MS5535A_zero 463 rcall reset_MS5535A_zero
485 bsf sensor_CLK 493 bsf sensor_CLK
486 nop 494 nop
487 nop 495 nop
488 nop 496 nop
489 nop 497 nop
490 nop 498 btfsc OSCCON,4 ; 32MHz Mode?
491 nop 499 rcall MS5535A_extra_wait ; Yes
492 bcf sensor_CLK 500 bcf sensor_CLK
493 return 501 return
494 502
495 recieve_loop: 503 recieve_loop:
496 bsf sensor_CLK 504 bsf sensor_CLK
497 nop 505 nop
498 nop 506 nop
499 nop 507 nop
500 nop 508 nop
501 nop 509 btfsc OSCCON,4 ; 32MHz Mode?
502 nop 510 rcall MS5535A_extra_wait ; Yes
503 bcf sensor_CLK 511 bcf sensor_CLK
504 btfss sensor_SDI ;MSB first 512 btfss sensor_SDI ;MSB first
505 bcf STATUS,C 513 bcf STATUS,C
506 btfsc sensor_SDI ;MSB first 514 btfsc sensor_SDI ;MSB first
507 bsf STATUS,C 515 bsf STATUS,C
519 bsf sensor_CLK 527 bsf sensor_CLK
520 nop 528 nop
521 nop 529 nop
522 nop 530 nop
523 nop 531 nop
524 nop 532 btfsc OSCCON,4 ; 32MHz Mode?
525 nop 533 rcall MS5535A_extra_wait ; Yes
526 bcf sensor_CLK 534 bcf sensor_CLK
527 nop 535 nop
528 nop 536 nop
529 nop 537 nop
530 nop 538 nop
531 nop 539 btfsc OSCCON,4 ; 32MHz Mode?
532 nop 540 rcall MS5535A_extra_wait ; Yes
533 bsf sensor_CLK 541 bsf sensor_CLK
534 nop 542 nop
535 nop 543 nop
536 nop 544 nop
537 nop 545 nop
538 nop 546 btfsc OSCCON,4 ; 32MHz Mode?
539 nop 547 rcall MS5535A_extra_wait ; Yes
540 bcf sensor_CLK 548 bcf sensor_CLK
541 nop 549 nop
542 nop 550 nop
543 nop 551 nop
544 nop 552 nop
545 nop 553 btfsc OSCCON,4 ; 32MHz Mode?
546 nop 554 rcall MS5535A_extra_wait ; Yes
547 bsf sensor_CLK 555 bsf sensor_CLK
548 nop 556 nop
549 nop 557 nop
550 nop 558 nop
551 nop 559 nop
552 nop 560 btfsc OSCCON,4 ; 32MHz Mode?
553 nop 561 rcall MS5535A_extra_wait ; Yes
554 bcf sensor_CLK 562 bcf sensor_CLK
555 ; now send 8 bytes from isr_temp1 and fill-up with zeros 563 ; now send 8 bytes from isr_temp1 and fill-up with zeros
556 datenbits: 564 databits:
557 btfss isr1_temp,7 ;MSB first 565 btfss isr1_temp,7 ;MSB first
558 bcf sensor_SDO 566 bcf sensor_SDO
559 btfsc isr1_temp,7 ;MSB first 567 btfsc isr1_temp,7 ;MSB first
560 bsf sensor_SDO 568 bsf sensor_SDO
561 bcf STATUS,C 569 bcf STATUS,C
564 bsf sensor_CLK 572 bsf sensor_CLK
565 nop 573 nop
566 nop 574 nop
567 nop 575 nop
568 nop 576 nop
569 nop 577 btfsc OSCCON,4 ; 32MHz Mode?
570 nop 578 rcall MS5535A_extra_wait ; Yes
571 bcf sensor_CLK 579 bcf sensor_CLK
572 580
573 decfsz clock_count,F 581 decfsz clock_count,F
574 bra datenbits 582 bra databits
575 return 583 return